<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>应收台账详情</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/dist/plugins/webuploader-0.1.5/webuploader.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=f5a12a1d">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .model-picker-input {
            opacity: 0 !important;
            top: -9999px;
            left: -9999px;
            position: absolute;
        }
        .tryStyle {
            width: 30px;
            height: 14px;
            line-height: 14px !important;
            font-size: 12px;
            /* top: 0; */
            right: 23px;
            position: absolute;
            border-radius: 5px;
            margin-top: -5px;
            background: red;
            color: #fff;
            margin-right: -2px;
            transform: scale(0.8);
        }
        .model-picker-span {
            position: relative;
            display: block;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            border-bottom: 1px solid #ccc;
            background-color: #fff;
            color: #ccc;
            cursor: pointer;
        }

        .model-picker-span > .placeholder {
            color: #aaa;
        }

        .model-picker-span > .arrow {
            position: absolute;
            top: 50%;
            right: 8px;
            width: 10px;
            margin-top: -3px;
            height: 5px;
            background: url(../images/drop-arrow.png) -10px -25px no-repeat;
        }

        .model-picker-span.focus,
        .model-picker-span.open {
            border-bottom-color: #46A4FF;
        }

        .model-picker-span.open > .arrow {
            background-position: -10px -10px;
        }

        .model-picker-span > .title > span {
            color: #333;
            padding: 5px;
            border-radius: 3px;
        }

        .model-picker-span > .title > span:hover {
            background-color: #f1f8ff;
        }

        .model-picker-dropdown {
            position: absolute;
            width: 315px;
            left: -9999px;
            top: -9999px;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            z-index: 999999;
            display: none;
            min-width: 200px;
            margin-bottom: 20px;
            margin-top: 5px;
        }

        .model-select-wrap {
            box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
        }

        .model-select-tab {
            border-bottom: 1px solid #ccc;
            background: #f5f5f5;
            /*font-size: 13px;*/
        }

        .model-select-tab > a {
            display: inline-block;
            padding: 4px 20px;
            border-left: 1px solid #ccc;
            border-bottom: 1px solid transparent;
            color: #4D4D4D;
            text-align: center;
            outline: 0;
            text-decoration: none;
            cursor: pointer;
            /*font-size: 14px;*/
            margin-bottom: -1px;
        }
        .benYwJieQ td.bH {
            color: red !important;
        }

        .bH {
            color: red !important;
        }
        .model-select-tab > a.active {
            background: #fff;
            border-bottom: 1px solid #fff;
            color: #46A4FF;
        }

        .model-select-tab > a:first-child {
            border-left: none;
        }

        .model-select-tab > a:last-child.active {
            border-right: 1px solid #ccc;
        }

        .model-select-content {
            width: 100%;
            min-height: 50px;
            background-color: #fff;
            padding: 5px 5px;
        }

        .model-select {
            /*font-size: 16px;*/
        }

        .model-select dl {
            line-height: 2;
            clear: both;
            padding: 3px 0;
            margin: 0;
            max-height: 200px;
            overflow-y: scroll;
        }

        .model-select dt {
            position: absolute;
            width: 2.5em;
            font-weight: 500;
            text-align: right;
            line-height: 2;
        }

        .model-select dd {
            margin-left: 0;
            line-height: 2;
        }

        .model-select.province dd {
            margin-left: 3em;
        }

        .model-select a {
            display: inline-block;
            padding: 0 10px;
            outline: 0;
            text-decoration: none;
            white-space: nowrap;
            margin-right: 2px;
            color: #333;
            cursor: pointer;
        }

        .model-select a:hover,
        .model-select a:focus {
            background-color: #f1f8ff;
            border-radius: 2px;
            color: #46A4FF;
        }

        .model-select a.active {
            background-color: #46A4FF;
            color: #fff;
            border-radius: 2px;
        }

        .table-detail input[type=text] {
            padding-left: 0;
        }

        td {
            color: #2a8cec;
        }

        td.td-title, td select, td .filename, td.td-module {
            color: #333;
        }

        select {
            color: rgb(42, 140, 236) !important;
            background: #fff;
        }

        .table-detail td {
            /*font-size: 16px;*/
            line-height: 35px;
            height: 35px;
            border-right: 1px solid #cbcbcb;
            border-bottom: 1px solid #cbcbcb;
        }

        .table-detail td.td-title {
            line-height: 1.5;
            background: #F5F5F5;
        }

        .table-detail td.td-row3 {
            height: 70px;
            line-height: 20px;
            max-height: 70px;
            overflow: hidden;
            position: relative;
        }
        .wdqStyle td {
            color: #cbcbcb;
        }
        .yuying {
            position: absolute;
            right: 10px;
            bottom: 10px;
            width: 20px;
            height: 20px;
            background: url("/dist/img/yuyin.png");
            background-size: cover;
            cursor: pointer;
        }

        input {
            text-align: left !important;
        }

        .table-detail td.td-value {
            text-align: left !important;
            padding-left: 4px !important;
            /*font-size: 16px !important;*/
        }

        .btn-group-xs > .btn, .btn-xs {
            padding: 1px 5px;
            /*font-size: 16px;*/
            line-height: 1.5;
            border-radius: 3px;
        }

        .table-detail textarea {
            height: 60px;
            width: 100%;
            border: none;
            outline: none;
            -webkit-appearance: none;
            resize: none;
            line-height: 20px;
            padding-top: 2px !important;
            padding-left: 6px;
        }

        .td-row3 span {
            max-height: 60px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
            text-align: left;

        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            width: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
            word-wrap: break-word;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 25px;
            top: -12px;
        }

        .td-module td {
            color: #fff;
            font-weight: normal;
        }

        .table-detail {
            border: none;
            table-layout: fixed;
        }

        .table-detail .td-module {
            color: #fff;
            font-weight: normal;
        }

        span.lineOne {
            line-height: 20px;
            height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        .table-detail td.td-tanZongStyle-line {
            padding: 1px !important;
            text-align: left !important;
        }

        .td-tanZongStyle-line input {
            box-shadow: inset 1px 1px 4px #333;
            height: 100% !important;
            padding-left: 4px !important;
        }

        .td-tanZongStyle-line select {
            box-shadow: inset 1px 1px 4px #333;
            height: 100% !important;
            padding-left: 4px !important;
        }

        .span-a-btn {
            position: absolute;
            right: 10px;

        }

        .white a {
            color: black;
        }

        .jieQ td {
            color: #2a8cec !important;
            /*color: red !important;*/
        }

        .benYwJieQ td {
            /*color: red !important;*/
            color: #2a8cec !important;
        }

        .wJieQ td {
            color: #2a8cec !important;
            /*color: red !important;*/
        }

        .IcoNormal {
            float: left;
            border-bottom: 0px;
            border-left: 0px;
            background-color: transparent;
            width: 16px;
            height: 16px;
            vertical-align: middle;
            border-top: 0px;
            border-right: 0px;
            background-image: url(/dist/img/upload_normal.gif);
            background-repeat: no-repeat;
            float: left;
            margin-top: 4px;
            margin-right: 5px;
            margin-left: 5px;
        }

        .progressobj {
            height: 20px;
        }

        .progressobj .delfile {
            float: left;
            margin-left: 10px;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span, .lineSpan {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
            padding-right: 10px;
        }

        .webuploader-pick {
            background: url(/dist/img/fjT1.png) no-repeat 5px center;
            padding: 0 4px;
            height: 22px;
            line-height: 22px;
            padding-left: 15px;
            margin: 0 auto;
            width: 45px;
            margin-top: 9px;
            border-radius: 4px;
        }

        .webuploader-pick-hover {
            color: #fff !important;
            background: url(/dist/img/fjT2.png) no-repeat 5px center;
            background-color: #0F6099;

        }

        .daoru .webuploader-pick {
            color: black;
            background: none;
            margin-right: 5px;
            margin-top: 0px;
            width: 134px;
        }

        .yellow {
            color: #fff !important;
            background-color: red;
        }

        .webuploader-pick {
            background: none;
            padding: 0 4px;
            height: 22px;
            line-height: 22px;
            /* padding-left: 15px; */
            margin: 0 auto;
            width: 45px;
            margin-top: 9px;
            border-radius: 4px;
        }
        .tableHeader{
            position: fixed;
            top:0;
            left:0;
            width: 100%;
            display: none;
            z-index: 1111;
        }
        .fix1{
            display: table;
        }
    </style>
</head>
<body>
<iframe id="ifAttach" style="display:none"></iframe>
<div class="div-td-content-more"><i></i></div>
<section class="content" id="app" v-cloak style="padding:0px;">
    <iframe id="ifExprot" style="width:0px;height:0px;display: none;" frameborder="0"></iframe>
    <div class="center" style="overflow:auto;overflow-x:hidden;">
        <table class="table-detail fix1 tableHeader" >
                <tr class="td-module" >
                    <td style="text-align: center;line-height: 35px;">客户基本信息</td>
                </tr>
        </table>
        <table class="table-detail">
            <tr class="td-module khjbxx" >
                <td colspan="4">客户基本信息</td>
            </tr>
            <tr>
                <td class="td-title" style="width: 12.5%;">客户名称</td>
                <td class="td-value" style="width: 12.5%;">
                    <span class="lineOne"> {{contract.main.buyer}}</span>
                </td>
                <td class="td-title" style="width: 12.5%;">联系电话</td>
                <td class="td-value" style="width: 12.5%;">
                    <span class="lineOne">{{contract.main.buyerTel}}</span>
                </td>

            </tr>
            <tr>
                <td class="td-title">实际使用人</td>
                <td class="td-tanZongStyle-line">
                    <input type="text" v-model="contract.main.actualUser"
                           v-if="pageType=='edit'&&contractCopy.main.actualUser==''"
                           placeholder="请输入"/>
                    <span v-else class="lineOne" style="margin-left: 3px;">{{contract.main.actualUser}}</span>
                </td>

                <td class="td-title">实际使用电话</td>
                <td class="lineOne">
                    <input type="text" v-model="contract.main.actualUserTel"
                           v-if="pageType=='edit'&&contractCopy.main.actualUserTel==''"
                           placeholder="请输入"/>
                    <span v-else class="lineOne" style="margin-left: 3px;">{{contract.main.actualUserTel}}</span>
                </td>


            </tr>
            <tr>
                <td class="td-title">工地及位置</td>
                <td class='td-tanZongStyle-line'>
                    <input type="text" v-model="contract.main.sitePosition"
                           v-if="pageType=='edit'&&contractCopy.main.sitePosition==''"
                           placeholder="请输入"/>
                    <span v-else class="lineOne" style="text-align: left;margin-left: 3px">{{contract.main.sitePosition}}</span>
                </td>
                <td class="td-title">设备状态</td>
                <td class="td-tanZongStyle-line">
                    <select v-model="contract.main.deviceState" v-if="pageType=='edit'">
                        <option v-for="(item,i) in deviceTypeList" v-bind:value="item.value">
                            {{item.text}}
                        </option>
                    </select>
                    <span v-else class="lineOne" style="margin-left: 3px;">{{contract.main.deviceState}}</span>
                </td>
            </tr>
            <tr>
                <td class="td-title" style="width: 12.5%;">交车日期</td>
                <td class="td-value" style="width: 12.5%;">
                    <!--<input type="text" v-if="pageType=='edit'" v-model="contract.main.deliveryDate" placeholder="选择日期" @focus="showDatePicker($event,'','deliveryDate')"/>-->
                    <!--<span v-else class="lineOne">{{contract.main.deliveryDate}}</span>-->
                    <span class="lineOne"> {{contract.main.deliveryDate}}</span>
                </td>
                <td class="td-title" style="width: 12.5%;">品牌</td>
                <td class="td-value" style="width: 12.5%;">
                    <span class="lineOne"> {{contract.main.brandName}}</span>
                </td>

            </tr>
            <tr>
                <td class="td-title">付款方式</td>
                <td class="td-value">
                    <span v-if="contract.main.buyType=='融资租赁打包'">
                        融资租赁(打包)
                    </span>
                    <span v-else class="lineOne">
                        <span class="lineOne">{{contract.main.buyType}}</span>
                    </span>
                </td>
                <td class="td-title">型号</td>
                <td class="td-value">
                    <span class="lineOne">{{contract.main.modelName}}</span>
                </td>
            </tr>
            <template v-if="contract.main.buyType =='内部分期'">
                <tr>
                    <td class="td-title">分期期限(个月)</td>
                    <td class="td-value">
                        <span class="lineOne">{{contract.sales.stageTerm}}</span>
                    </td>
                    <td class="td-title"></td>
                    <td class="td-value">
                        <span class="lineOne"></span>
                    </td>
                </tr>
            </template>
            <template v-if="contract.main.buyType =='融资租赁'">
                <tr>
                    <td class="td-title">融资公司</td>
                    <td class="td-value">
                        <span class="lineOne"> {{contract.main.financeCompany}}</span>
                    </td>
                    <td class="td-title">融资期限(个月)</td>
                    <td class="td-value">
                        <span class="lineOne"> {{contract.sales.loanTerm}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">以旧换新</td>
                    <td class="td-value">
                        <span class="lineOne"> {{contract.main.haveReplacement=='1'?'是':'否'}}</span>
                    </td>
                    <td class="td-title">置换价格(元)</td>
                    <td class="td-value">
                        <span class="lineOne"> {{fmoney(contract.replacement.total)}}</span>
                    </td>
                </tr>
            </template>
            <template v-if="contract.main.buyType =='融资租赁打包'">
                <tr>
                    <td class="td-title" style="width: 12.5%;">融资公司</td>
                    <td class="td-value" style="width: 12.5%;">
                        <span class="lineOne"> {{contract.main.financeCompany}}</span>
                    </td>

                    <td class="td-title" style="width: 12.5%;">融资期限(个月)</td>
                    <td class="td-value" style="width: 12.5%;">
                        <span class="lineOne"> {{contract.sales.loanTerm}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">月还款</td>
                    <td class="td-value">
                        <span class="lineOne">{{fmoney(contract.sales.monthlyRepayment)}}</span>
                    </td>
                    <td class="td-title">以旧换新</td>
                    <td class="td-value">
                        <span class="lineOne">{{contract.main.haveReplacement=='1'?'是':'否'}}</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-title">置换价格(元)</td>
                    <td class="td-value">
                        <span class="lineOne"> {{fmoney(contract.replacement.total)}}</span>

                    </td>
                    <td class="td-title">合计</td>
                    <td class="td-value">
                        <span class="lineOne"> {{contract.sales.total}}</span>
                    </td>
                </tr>
            </template>
        </table>
        <!--总欠款合计-->
        <template v-if="contract.main.buyType!='全款'">
            <table class="table-detail fix2 tableHeader" >
                <tr class="td-module" >
                    <td colspan="4">总欠款合计</td>
                </tr>
                <tr>
                    <td class="td-title"></td>
                    <td class="td-title">总欠款(元)</td>
                    <td class="td-title">到期欠款(元)</td>
                    <td class="td-title">未到期欠款(元)</td>
                    <!--<td class="td-title">本期应还(元)</td>-->
                </tr>
            </table>
            <table class="table-detail sxtable header2">
                <tr class="td-module">
                    <td colspan="4">总欠款合计
                    </td>

                </tr>
                <tr>
                    <td class="td-title"></td>
                    <td class="td-title">总欠款(元)</td>
                    <td class="td-title">到期欠款(元)</td>
                    <td class="td-title">未到期欠款(元)</td>
                    <!--<td class="td-title">本期应还(元)</td>-->
                </tr>
                <tr>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">

                        <span>首付款</span>
                    </td>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span>{{fmoney(DqMoney)}}</span>
                    </td>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">

                        <span>{{fmoney(contract.main.SFPay)}}</span>
                    </td>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span>{{fmoney(WdqMoney)}}</span>
                    </td>
                    <!--<td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span>{{fmoney(contract.main.SFPay)}}</span>
                    </td>-->
                </tr>
                <tr>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span v-if="contract.main.buyType=='内部分期'"> 内部分期款</span>
                        <span v-else class="lineOne" style="text-align: center !important;"> {{contract.main.brandName}}融资款</span>
                    </td>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span>{{fmoney(FQDqMoney)}}</span>
                    </td>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span >{{fmoney(contract.main.RZPay)}}</span>
                    </td>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span v-if="contract.main.buyType != '内部分期'">以融资公司为准</span>

                        <span v-else>{{fmoney(FQWdqMoney)}}</span>
                    </td>
                    <!--<td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span>{{fmoney(contract.main.RZPay)}}</span>
                    </td>-->
                </tr>
                <tr>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">

                        <span>合计</span>
                    </td>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span>{{fmoney(DqSumMoney)}}</span>
                    </td>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span>{{fmoney(contract.main.totalPay)}}</span>
                    </td>
                    <td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span>{{fmoney(wDqSumMoney)}}</span>
                    </td>
                    <!--<td class="td-tanZongStyle-line" style="text-align: center !important;">
                        <span>{{fmoney(contract.main.totalPay)}}</span>
                    </td>-->
                </tr>
            </table>
        </template>
        <template v-if="contract.main.buyType=='全款'">
            <table class="table-detail fix2 tableHeader" >
                <tr class="td-module" >
                    <td colspan="4">付款信息</td>
                </tr>
            </table>
            <table class="table-detail header2">
                <tr class="td-module">
                    <td colspan="4">付款信息</td>
                </tr>
                <tr>
                    <td class="td-title" style="width: 12.5%;">付款时间</td>
                    <td class="td-value" style="width: 12.5%;">
                        <input type="text" v-if="pageType=='edit'"
                               v-model="contract.main.paymentTime"
                               placeholder="选择日期" @focus="showDatePicker($event,'','paymentTime')"/>
                        <span v-else class="lineOne">{{contract.main.paymentTime}}</span>
                    </td>
                    <td class="td-title" style="width: 12.5%;">付款金额(元)</td>
                    <td class="td-tanZongStyle-line" style="width: 12.5%;">
                        <input v-if="pageType=='edit'" type="text"
                               @blur="strFormat($event.target,'contract.main.paymentAmount')"
                               @focus="strFormatF($event.target,'contract.main.paymentAmount')"
                               @click.once="strFormatF($event.target,'contract.main.paymentAmount'),strFormat($event.target,'contract.main.paymentAmount')"
                               v-onedate="fmoney(contract.main.paymentAmount)"/>
                        <span v-else class="lineOne">{{fmoney(contract.main.paymentAmount)}}</span>

                    </td>
                </tr>
            </table>
        </template>
        <!--******************************************* 首付款跟踪 ******************************************************-->
        <template v-if="contract.main.buyType=='全款'">
            <table class="table-detail fix3 tableHeader" style="margin-left: 1px">
                <tr>
                    <td colspan="5" class="td-module">
                        款项跟踪
                    </td>
                </tr>
                <tr>
                    <!--<td class="td-title" style="width: 20%;">款项</td>-->
                    <td class="td-title" style="width: 20%">销售合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%">约定付款金额(元)</td>
                    <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>

                </tr>
            </table>
            <table class="table-detail header3">
                <tr>
                    <td colspan="5" class="td-module">
                        款项跟踪
                    </td>
                </tr>
                <tr>
                    <!--<td class="td-title" style="width: 20%;">款项</td>-->
                    <td class="td-title" style="width: 20%">销售合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%">约定付款金额(元)</td>
                    <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>
                </tr>
                <template v-for="(item,i) in main.repaySFMent">
                    <tr class="benYwJieQ">
                        <!--<td class="td-value" style="text-align: center !important;" :rowspan="item.repaymentParentList.length+1">-->
                        <!--首付款-->
                        <!--</td>-->
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1"
                        >
                            <input
                                   v-if="pageType=='edit'&&item.repaymentParentList.length===0"
                                   v-model="item.repaymentDate" placeholder="选择日期"
                                   @focus="showDatePicker($event,item,'repaymentDate')"
                                   style="text-align: center !important;"/>
                            <span
                                  v-else>{{item.repaymentDate}}</span>
                            <span style="text-align: center" v-if="!changeRed('repaySFMent',i)" class="tryStyle">逾期</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #ffde00;color: #fff;text-align: center">到期</span>

                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1"
                        >
                            <input v-if="pageType=='edit'&&item.repaymentParentList.length===0"
                                   type="text"
                                   @blur="strFormat($event.target,'main.repaySFMent.'+i+'.total')"
                                   @focus="strFormatF($event.target,'main.repaySFMent.'+i+'.total')"
                                   @click.once="strFormatF($event.target,'main.repaySFMent.'+i+'.total'),strFormat($event.target,'main.repaySFMent.'+i+'.total')"
                                   v-onedate="fmoney(item.total)"
                                   style="text-align: center !important;"/>
                            <span  v-else>{{fmoney(item.total)}}</span>
                            <span style="text-align: center" v-if="!changeRed('repaySFMent',i)" class="tryStyle">逾期</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>


                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item.actualRepaymentDate?item.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item,'qianKuan')?'bH':''" >
                            <span v-if="compareFiveDate(item.repaymentDate)>0">-</span>
                            <span v-else>{{fmoney(item.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item,'faXi')?'bH':''" style="text-align: center !important;">
                            <span>{{fmoney(item.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                    <tr v-for="(item2,i2) in item.repaymentParentList" class="benYwJieQ">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;" :class="showToday(item2)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item2.actualRepaymentDate?item2.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item2.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item2,'qianKuan')?'bH':''">
                            <span>{{fmoney(item2.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'faXi')?'bH':''">
                            <span>{{fmoney(item2.everyOverduePenalty)}}</span>
                        </td>
                    </tr>

                </template>
                <template v-for="(item,i) in main.repayDKMent">
                    <tr class="benYwJieQ">
                        <td class="td-value" style="text-align: center !important;"
                        >
                            <span>{{item.repaymentDate}}</span>
                            <span style="text-align: center" v-if="!changeRed('repayDKMent',i)" class="tryStyle">逾期</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>

                        </td>
                        <td class="td-value" style="text-align: center !important;"
                        >
                            <span>{{fmoney(item.principal)}}</span>
                            <span style="text-align: center" v-if="!changeRed('repayDKMent',i)" class="tryStyle">逾期</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>


                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item.actualRepaymentDate?item.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item,'qianKuan')?'bH':''" >
                            <span v-if="compareFiveDate(item.repaymentDate)>0">-</span>
                            <span v-else>{{fmoney(item.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item,'faXi')?'bH':''" style="text-align: center !important;">
                            <span>{{fmoney(item.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                    <tr v-for="(item2,i2) in item.repaymentParentList" class="benYwJieQ">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;" :class="showToday(item2)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item2.actualRepaymentDate?item2.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item2.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item2,'qianKuan')?'bH':''">
                            <span>{{fmoney(item2.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'faXi')?'bH':''">
                            <span>{{fmoney(item2.everyOverduePenalty)}}</span>
                        </td>
                    </tr>

                </template>

            </table>
        </template>
        <!--&&contract.main.haveRepayment=='1'-->
        <template v-if="contract.main.buyType!='全款'">
            <table class="table-detail fix3 tableHeader" style="margin-left: 1px">
                <tr>
                    <td colspan="5" class="td-module">
                        首付款跟踪
                    </td>
                </tr>
                <tr>
                    <td class="td-title" style="width: 20%">销售合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                    <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>

                </tr>
            </table>
            <table class="table-detail header3">
                <tr>
                    <td colspan="5" class="td-module">
                        首付款跟踪
                    </td>
                </tr>
            </table>
            <table class="table-detail">
                <tr>
                    <td class="td-title" style="width: 20%">销售合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                    <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>

                </tr>
                <template v-for="(item,i) in main.repaySFMent">
                    <tr :class="(compareFiveDate(item.repaymentDate)>0&&!item.xyq)?'wdqStyle':'benYwJieQ'">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1"
                        >
                            <template  v-if="changeYellow(item.repaymentDate)">
                                <input type="text"
                                       v-if="pageType=='edit'&&item.repaymentParentList.length===0&&(!item.repaymentAmount||!item.actualRepaymentDate)"
                                       v-model="item.repaymentDate" placeholder="选择日期"
                                       @focus="showDatePicker($event,item,'repaymentDate')"
                                       />
                                <span style="background-color: orange !important;color: black !important;"
                                      v-else>{{item.repaymentDate}}</span>
                                <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>
                            </template>
                            <template v-else>
                                <input type="text"
                                       v-if="pageType=='edit'&&item.repaymentParentList.length===0&&(!item.repaymentAmount||!item.actualRepaymentDate)"
                                       v-model="item.repaymentDate" placeholder="选择日期"
                                       @focus="showDatePicker($event,item,'repaymentDate')"
                                       style="text-align: center !important;"/>
                                <span v-else>{{item.repaymentDate}}</span>
                                <span style="text-align: center" v-if="!changeRed('repaySFMent',i)" class="tryStyle">逾期</span>
                            </template>

                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1"
                        >
                            <template v-if="changeYellow(item.repaymentDate)">
                                <input
                                       v-if="pageType=='edit'&&item.repaymentParentList.length===0&&(!item.repaymentAmount||!item.actualRepaymentDate)"
                                       type="text"
                                       @blur="strFormat($event.target,'main.repaySFMent.'+i+'.total')"
                                       @focus="strFormatF($event.target,'main.repaySFMent.'+i+'.total')"
                                       @click.once="strFormatF($event.target,'main.repaySFMent.'+i+'.total'),strFormat($event.target,'main.repaySFMent.'+i+'.total')"
                                       v-onedate="fmoney(item.total)"/>
                                <span v-else>{{fmoney(item.total)}}</span>
                                <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>

                            </template>
                            <template v-else>
                                <input
                                       v-if="pageType=='edit'&&item.repaymentParentList.length===0&&(!item.repaymentAmount||!item.actualRepaymentDate)"
                                       type="text"
                                       @blur="strFormat($event.target,'main.repaySFMent.'+i+'.total')"
                                       @focus="strFormatF($event.target,'main.repaySFMent.'+i+'.total')"
                                       @click.once="strFormatF($event.target,'main.repaySFMent.'+i+'.total'),strFormat($event.target,'main.repaySFMent.'+i+'.total')"
                                       v-onedate="fmoney(item.total)"
                                       style="text-align: center !important;"/>
                                <span
                                      v-else>{{fmoney(item.total)}}</span>
                                <span style="text-align: center" v-if="!changeRed('repaySFMent',i)" class="tryStyle">逾期</span>

                            </template>

                        </td>

                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item.actualRepaymentDate?item.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item,'qianKuan')?'bH':''">
                            <span v-if="compareFiveDate(item.repaymentDate)>0">-</span>
                            <span v-else>{{fmoney(item.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item,'faXi')?'bH':''" style="text-align: center !important;">
                            <span>{{fmoney(item.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                    <tr v-for="(item2,i2) in item.repaymentParentList" class="benYwJieQ">
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item2.actualRepaymentDate?item2.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item2.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item2,'qianKuan')?'bH':''">
                            <span>{{fmoney(item2.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'faXi')?'bH':''">
                            <span>{{fmoney(item2.everyOverduePenalty)}}</span>
                        </td>
                    </tr>

                </template>
                <template v-for="(item,i) in main.repayDKMent">
                    <tr :class="(compareFiveDate(item.repaymentDate)>0&&!item.xyq)?'wdqStyle':'benYwJieQ'">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1">
                            <span>{{item.repaymentDate}}</span>
                            <span style="text-align: center" v-if="!changeRed('repayDKMent',i)" class="tryStyle">逾期</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>

                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1"
                        >
                            <span>{{fmoney(item.principal)}}</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>
                            <span style="text-align: center" v-if="!changeRed('repayDKMent',i)" class="tryStyle">逾期</span>

                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item.actualRepaymentDate?item.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item,'qianKuan')?'bH':''">
                            <span v-if="compareFiveDate(item.repaymentDate)>0">-</span>
                            <span v-else>{{fmoney(item.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            style="text-align: center !important;"
                            :class="showToday(item,'faXi')?'bH':''">
                            <span>{{fmoney(item.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                    <tr v-for="(item2,i2) in item.repaymentParentList" class="benYwJieQ">
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item2.actualRepaymentDate?item2.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item2.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item2,'qianKuan')?'bH':''">
                            <span>{{fmoney(item2.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'faXi')?'bH':''">
                            <span>{{fmoney(item2.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                </template>
            </table>
        </template>
        <template v-if="contract.main.buyType=='融资租赁'">
            <table class="table-detail fix4 tableHeader" style="margin-left: 1px">
               <template v-if="contract.main.haveDsdf=='1'" >
                   <tr>
                       <td colspan="5" class="td-module">
                           <span>销售合同还款跟踪</span>
                       </td>
                   </tr>
                   <tr>
                       <td class="td-title" style="width: 20%">销售合同<br>还款日期</td>
                       <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                       <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                       <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                       <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>
                   </tr>
               </template>
                <template v-if="contract.main.haveDsdf=='0'">
                    <tr>
                        <td colspan="5" class="td-module">
                            <span style="text-align: center !important;">{{contract.main.brandName}}融资合同还款跟踪</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="td-title" style="width: 20%">融资合同<br>还款日期</td>
                        <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                        <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                        <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                        <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>
                    </tr>
                </template>
            </table>
            <table class="table-detail eachT header4" v-scroll-div v-if="contract.main.haveDsdf=='1'">
                <template>
                    <tr>
                        <td colspan="5" class="td-module">
                            <span>销售合同还款跟踪</span>
                        </td>
                    </tr>

                </template>
            </table>
            <table class="table-detail eachT" v-if="contract.main.haveDsdf=='1'">
                <tr>
                    <td class="td-title" style="width: 20%">销售合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                    <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>
                </tr>
                <template v-for="(item,i) in main.repayRZMent">
                    <tr :class="(compareFiveDate(item.repaymentDate)>0&&!item.xyq)?'wdqStyle':'benYwJieQ'">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1"
                        >
                              <span >{{item.repaymentDate}}</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>

                            <span style="text-align: center" v-if="!changeRed('repayRZMent',i)" class="tryStyle">逾期</span>

                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1"
                        >
                            <span >{{fmoney(item.contractRepaymentAmount)}}</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>

                            <span style="text-align: center" v-if="!changeRed('repayRZMent',i)" class="tryStyle">逾期</span>

                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item.actualRepaymentDate?item.actualRepaymentDate:'-'}}</span>
                            <span style="text-align: center !important;">{{fmoney(item.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item,'qianKuan')?'bH':''">
                            <span v-if="compareFiveDate(item.repaymentDate)>0">-</span>
                            <span v-else>{{fmoney(item.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item,'faXi')?'bH':''">
                            <span>{{fmoney(item.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                    <tr v-for="(item2,i2) in item.repaymentParentList" class="benYwJieQ">
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd"
                            >{{item2.actualRepaymentDate?item2.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item2.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item2,'qianKuan')?'bH':''">
                            <span>{{fmoney(item2.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'faXi')?'bH':''">
                            <span>{{fmoney(item2.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                </template>
            </table>
            <table class="table-detail eachT header4" v-if="contract.main.haveDsdf=='0'">
                <template>
                    <tr>
                        <td colspan="5" class="td-module">
                            <span style="text-align: center !important;">{{contract.main.brandName}}融资合同还款跟踪</span>
                        </td>
                    </tr>
                </template>
            </table>
            <table class="table-detail eachT" v-if="contract.main.haveDsdf=='0'">
                <tr>
                    <td class="td-title" style="width: 20%">融资合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                    <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>
                </tr>
                <template v-for="(item,i) in main.repayRZMentFn">
                    <tr :class="(compareFiveDate(item.financingDate)>0&&!item.xyq)?'wdqStyle':'benYwJieQ'">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1">
                            <span style="text-align: center !important;">{{item.financingDate}}</span>
                            <span v-if="changeYellow(item.financingDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>
                            <span style="text-align: center" v-if="!changeRedFn('repayRZMentFn',i)" class="tryStyle">逾期</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1">
                            <span style="text-align: center !important;"
                                  >{{fmoney(item.financingMoney)}}</span>
                            <span v-if="changeYellow(item.financingDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>
                            <span style="text-align: center" v-if="!changeRedFn('repayRZMentFn',i)" class="tryStyle">逾期</span>

                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item.advancesDate?item.advancesDate:'-'}}</span>
                            <span
                                  style="text-align: center !important;">{{fmoney(item.advancesMoney)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item,'qianKuan')?'bH':''">
                            <span v-if="compareFiveDate(item.financingDate)>0">-</span>
                            <span v-else>{{fmoney(item.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            style="text-align: center !important;"
                            :class="showToday(item,'faXi')?'bH':''">
                            <span>{{fmoney(item.jroverduePenalty)}}</span>
                        </td>
                    </tr>
                    <tr v-for="(item2,i2) in item.repaymentParentList" class="benYwJieQ">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item2.advancesDate?item2.advancesDate:'-'}}</span>
                            <span
                                  style="text-align: center !important;">{{fmoney(item2.advancesMoney)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'qianKuan')?'bH':''">
                            <span>{{fmoney(item2.everyRemainingArrear)}}</span>

                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'faXi')?'bH':''">
                            <span>{{fmoney(item2.jroverduePenalty)}}</span>
                        </td>
                    </tr>
                </template>
            </table>
        </template>

        <template v-if="contract.main.buyType=='融资租赁打包'">
            <table class="table-detail fix4 tableHeader" style="margin-left: 1px">
                <template v-if="contract.main.haveDsdf=='1'">
                    <tr>
                        <td colspan="5" class="td-module">
                            <span>销售合同还款跟踪</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="td-title" style="width: 20%">销售合同<br>还款日期</td>
                        <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                        <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                        <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                        <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>
                    </tr>
                </template>
                <template v-if="contract.main.haveDsdf=='0'">
                    <tr>
                        <td colspan="5" class="td-module">
                            <span style="text-align: center !important;">{{contract.main.brandName}}融资合同还款跟踪</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="td-title" style="width: 20%">融资合同<br>还款日期</td>
                        <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                        <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                        <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                        <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>

                    </tr>
                </template>
            </table>
            <table class="table-detail eachT header4" v-scroll-div v-if="contract.main.haveDsdf=='1'">
                <template>
                    <tr>
                        <td colspan="5" class="td-module ">
                            <span> 销售合同还款跟踪</span>
                        </td>
                    </tr>
                </template>
            </table>
            <table class="table-detail eachT" v-if="contract.main.haveDsdf=='1'">
                <tr>
                    <td class="td-title" style="width: 20%">销售合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                    <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>
                </tr>
                <template v-for="(item,i) in main.repayRZDBMent">
                    <tr :class="(compareFiveDate(item.repaymentDate)>0&&!item.xyq)?'wdqStyle':'benYwJieQ'">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1"
                        >
                            <span  style="text-align: center !important;">{{item.repaymentDate}}</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>

                            <span style="text-align: center" v-if="!changeRed('repayRZDBMent',i)" class="tryStyle">逾期</span>

                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1"
                        >
                            <span  style="text-align: center !important;">{{fmoney(item.contractRepaymentAmount)}}</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>

                            <span style="text-align: center" v-if="!changeRed('repayRZDBMent',i)" class="tryStyle">逾期</span>

                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item.actualRepaymentDate?item.actualRepaymentDate:'-'}}</span>
                            <span  style="text-align: center !important;">{{fmoney(item.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item,'qianKuan')?'bH':''">
                            <span v-if="compareFiveDate(item.repaymentDate)>0">-</span>
                            <span v-else>{{fmoney(item.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item,'faXi')?'bH':''">
                            <span>{{fmoney(item.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                    <tr v-for="(item2,i2) in item.repaymentParentList" class="benYwJieQ">
                        <td class="td-tanZongStyle-line" :class="showToday(item2)?'bH':''"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item2.actualRepaymentDate?item2.actualRepaymentDate:'-'}}</span>
                            <span  style="text-align: center !important;">{{fmoney(item2.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" :class="showToday(item2)?'bH':''"
                            style="text-align: center !important;">
                            <span>{{fmoney(item2.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'faXi')?'bH':''">
                            <span>{{fmoney(item2.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                </template>
            </table>
            <table class="table-detail eachT header4" v-if="contract.main.haveDsdf=='0'">
                <template>
                    <tr>
                        <td colspan="4" class="td-module">
                            <span style="margin-left: 140px">{{contract.main.brandName}}融资合同还款跟踪</span>
                        </td>
                    </tr>

                </template>
            </table>
            <table class="table-detail eachT" v-if="contract.main.haveDsdf=='0'">
                <tr>
                    <td class="td-title" style="width: 20%">融资合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%">还款金额<br>(元)</td>
                    <td class="td-title" style="width: 20%">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%">逾期罚息<br>(元)</td>

                </tr>
                <template v-for="(item,i) in main.repayRZMentFnDB">
                    <tr :class="(compareFiveDate(item.financingDate)>0&&!item.xyq)?'wdqStyle':'benYwJieQ'">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1">
                            <span  style="text-align: center !important;">{{item.financingDate}}</span>
                            <span v-if="changeYellow(item.financingDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>
                            <span style="text-align: center" v-if="!changeRedFn('repayRZMentFnDB',i)" class="tryStyle">逾期</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1">
                             <span style="text-align: center !important;">{{fmoney(item.financingMoney)}}</span>
                            <span v-if="changeYellow(item.financingDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>
                            <span style="text-align: center" v-if="!changeRedFn('repayRZMentFnDB',i)" class="tryStyle">逾期</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item.advancesDate?item.advancesDate:'-'}}</span>
                            <span
                                  style="text-align: center !important;">{{fmoney(item.advancesMoney)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item,'qianKuan')?'bH':''">
                            <span v-if="compareFiveDate(item.financingDate)>0">-</span>
                            <span v-else>{{fmoney(item.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item,'faXi')?'bH':''">
                            <span>{{fmoney(item.jroverduePenalty)}}</span>
                        </td>
                    </tr>
                    <tr v-for="(item2,i2) in item.repaymentParentList" class="benYwJieQ">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item2.advancesDate?item2.advancesDate:'-'}}</span>
                            <span
                                  style="text-align: center !important;">{{fmoney(item2.advancesMoney)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'qianKuan')?'bH':''">
                            <span>{{fmoney(item2.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'faXi')?'bH':''">

                            <span>{{fmoney(item2.jroverduePenalty)}}</span>
                        </td>
                    </tr>
                </template>
            </table>
        </template>
        <template v-if="contract.main.buyType=='内部分期'">
            <table class="table-detail fix4 tableHeader" style="margin-left: 1px">
                <tr class="td-module">
                    <td colspan="5"> 内部分期款跟踪</td>
                </tr>
                <tr>
                    <td class="td-title" style="width: 20%;">销售合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%;">还款金额<br>(元)</td>
                    <td class="td-title" style="width: 20%;">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%;">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%;">逾期罚息<br>(元)</td>

                </tr>
            </table>
            <table class="table-detail header4">
                <tr class="td-module">
                    <td colspan="5"> 内部分期款跟踪</td>
                </tr>
            </table>
            <table class="table-detail">
                <tr>
                    <td class="td-title" style="width: 20%;">销售合同<br>还款日期</td>
                    <td class="td-title" style="width: 20%;">还款金额<br>(元)</td>
                    <td class="td-title" style="width: 20%;">还款日期<br>还款金额</td>
                    <td class="td-title" style="width: 20%;">剩余欠款<br>(元)</td>
                    <td class="td-title" style="width: 20%;">逾期罚息<br>(元)</td>

                </tr>
                <template v-for="(item,i) in main.repayFQMent">
                    <tr :class="(compareFiveDate(item.repaymentDate)>0&&!item.xyq)?'wdqStyle':'benYwJieQ'">
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1">
                            <span>{{item.repaymentDate}}</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>
                            <span style="text-align: center" v-if="!changeRed('repayFQMent',i)" class="tryStyle">逾期</span>

                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :rowspan="item.repaymentParentList.length+1">
                            <span style="text-align: center !important;">{{fmoney(item.principal)}}</span>
                            <span v-if="changeYellow(item.repaymentDate)" class="tryStyle" style="background: #2a8cec;color: #fff;text-align: center">到期</span>
                            <span style="text-align: center" v-if="!changeRed('repayFQMent',i)" class="tryStyle">逾期</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item.actualRepaymentDate?item.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item,'qianKuan')?'bH':''">
                            <span v-if="compareFiveDate(item.repaymentDate)>0">-</span>
                            <span v-else>{{fmoney(item.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item,'faXi')?'bH':''">

                            <span>{{fmoney(item.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                    <tr v-for="(item2,i2) in item.repaymentParentList" class="benYwJieQ">
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;" :class="showToday(item)?'bH':''">
                            <span style="border-bottom: 1px solid #ddd">{{item2.actualRepaymentDate?item2.actualRepaymentDate:'-'}}</span>
                            <span>{{fmoney(item2.repaymentAmount)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line"
                            style="text-align: center !important;"
                            :class="showToday(item2,'qianKuan')?'bH':''">
                            <span>{{fmoney(item2.everyRemainingArrear)}}</span>
                        </td>
                        <td class="td-tanZongStyle-line" style="text-align: center !important;"
                            :class="showToday(item2,'faXi')?'bH':''">
                            <span>{{fmoney(item2.everyOverduePenalty)}}</span>
                        </td>
                    </tr>
                </template>
            </table>
        </template>
    </div>
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oaApp.js"></script>
<script src="/page/apply/contract/Template.js?t=42e28def"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    var wNumber = $(this).outerWidth()
                    if ($(this).hasClass('otherMore')) {
                        wNumber = $(this).outerWidth() * 2 - 2
                    }
                    $(".div-td-content-more").html(text).css({
                        "width": wNumber + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
    $(function () {
        $("body").on("click", ".divMore", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {

                var text = $(this).val();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script>
    // 注册一个局自定义指令 `v-inputOnce`
    Vue.directive('onedate', {
        // 当被绑定的元素插入到 DOM 中时……
        inserted: function (el) {
            // 聚焦元素
            el.focus()
            el.blur()
        },
        componentUpdated: function (el, binding) {
            // 聚焦元素


        }
    })
</script>
<script type="text/javascript">
    //api = frameElement.api, W = api.opener;
    var app = new Vue({
            el: '#app',
            data: {
                canUseMoney: 0,
                currentfocus: 0,
                DqMoney: 0,
                WdqMoney: 0,
                FQWdqMoney: 0,
                FQDqMoney: 0,
                wDqSumMoney: 0,
                DqSumMoney: 0,
                repayRZMentFnNum: 0,
                repayRZDBMentNum: 0,
                repayRZMentNum: 0,
                repayRZMentFnDBNum: 0,
                userId: getCurrentUser().id,
                id: getUrlParamObj().id,
                pageType: getUrlParamObj().pageType,//页面类型
                buyType: getUrlParamObj().buyType,
                zhihuan: getUrlParamObj().zhihuan,
                diankuan: getUrlParamObj().diankuan,
                rongzi: getUrlParamObj().rongzi,
                companyId: getUrlParamObj().companyId ? getUrlParamObj().companyId : '',
                regionManagerName: getUrlParamObj().regionManagerName ? getUrlParamObj().regionManagerName : '',
                regionManagerId: getUrlParamObj().regionManagerId ? getUrlParamObj().regionManagerId : '',
                thisMonth: new Date().Format("yyyy-MM"),
                brandName: "利勃海尔",
                today: "",
                brandId: '',
                companyList: [],
                provinceList: [],
                cityList: [],
                count: [],
                deviceTypeList: [
                    {text: '', value: ''},
                    {text: '正常使用', value: '正常使用'},
                    {text: '工地停工', value: '工地停工'},
                    {text: '故障停工', value: '故障停工'},
                    {text: '其他', value: '其他'}
                ],
                contractTypeList: ['sales'],
                modelMessage: '',
                text: "",
                brandList: [],
                modelList: [],
                buyType: "全款",
                buyTypeList: [
                    {name: '全款', value: '全款'},
                    {name: '内部分期', value: '内部分期'},
                    {name: '融资租赁', value: '融资租赁'},
                ],
                customerTypeList: [
                    {name: '', value: ''},
                    {name: '', value: ''},
                    {name: 'T类：拖车客户', value: 'T类：拖车客户'},
                    {name: 'F类：已转法务', value: 'F类：已转法务'},
                    {name: '已结清', value: '已结清'},
                ],
                contract: {
                    main: {city: "", customerCredit: ''}
                    ,
                    acceptance: {}
                    ,
                    commitment: {}
                    ,
                    confidentiality: {}
                    ,
                    guarantee: {}
                    ,
                    repaymentList: [],
                    repaymentFQList: [],
                    repaymentRZList: [],
                    repaymentDKList: [],
                    repaymentSFList: [],
                    repaymentRZDBList: [],
                    financingRZDBList: [],
                    financingRZList: [],
                    collectionList: [],
                    availableList: [],
                    regionManagerList: [],//区域经理
                    bigRegionManagerList: [],//大区经理
                    regionSupportList: [],//区域支持
                    creditorManagerList: [],//债权经理
                    dataManagerList: [],//应收专员
                    replacement: {
                        replacementsName: ['wjj'],
                        description: "",
                        wjj: [
                            new Template.jiuJi('挖掘机')
                        ],
                        zzj: [
                            new Template.jiuJi('装载机')
                        ],
                        qiChe: [
                            new Template.qiChe()
                        ],
                        fangWu: [
                            new Template.fangWu()
                        ],
                        other: [
                            new Template.other()
                        ]

                    }
                    ,
                    sales: {}
                    ,
                    supplementary: {},
                    guarantorList: [
                        new Template.guarantorTem()
                    ],
                },
                contractCopy: {
                    main: {city: "", customerCredit: ''}
                    ,
                    acceptance: {}
                    ,
                    commitment: {}
                    ,
                    confidentiality: {}
                    ,
                    guarantee: {}
                    ,
                    repaymentList: [],
                    repaymentFQList: [],
                    repaymentRZList: [],
                    repaymentDKList: [],
                    repaymentSFList: [],
                    repaymentRZDBList: [],
                    financingRZDBList: [],
                    financingRZList: [],
                    collectionList: [],
                    replacement: {
                        replacementsName: ['wjj'],
                        description: "",
                        wjj: [
                            new Template.jiuJi('挖掘机')
                        ],
                        zzj: [
                            new Template.jiuJi('装载机')
                        ],
                        qiChe: [
                            new Template.qiChe()
                        ],
                        fangWu: [
                            new Template.fangWu()
                        ],
                        other: [
                            new Template.other()
                        ]

                    }
                    ,
                    sales: {}
                    ,
                    supplementary: {},
                    guarantorList: [
                        new Template.guarantorTem()
                    ],
                },
                auditors: [],
                copiers: [],
                history: [],
                companyInfo: {},
                main: {
                    city: "",
                    regionalSupportName: '',
                    repayMent: [
                        new Template.repayMent()
                    ],
                    repayRZMentFn: [],
                    repayRZMentFnDB: [],
                    repayFQMent: [],
                    repayRZMent: [
                        new Template.repayRZMentList('')
                    ],
                    repayRZDBMent: [
                        new Template.repayRZMentList('')
                    ],
                    repaySFMent: [
                        new Template.repaySFMentList('')
                    ],
                    repayDKMent: [],
                },
            },
            computed: {
                getSalesTotal: function () {
                    //合同中首付款金额+保证金+手续费+担保费+保险费+GPS费
                    return this.fmoney(Number(this.contract.sales.firstPayment) + Number(this.contract.sales.bond) + Number(this.contract.sales.serviceCharge) + Number(this.contract.sales.securityCharge) + Number(this.contract.sales.insurancePremium) + Number(this.contract.sales.gpsCharge))
                },
                getBuyCarTotal: function () {
                    //合同中首付款金额+保证金+手续费+担保费+保险费+GPS费
                    var a = 0;
                    for (var i = 0; i < this.main.repayRZMent.length; i++) {
                        a = Number(this.main.repayRZMent[i].contractRepaymentAmount) + Number(a);
                    }
                    return this.fmoney(Number(this.contract.sales.firstPayment) + Number(this.contract.sales.bond) + Number(this.contract.sales.serviceCharge) + Number(this.contract.sales.securityCharge) + Number(this.contract.sales.insurancePremium) + Number(this.contract.sales.gpsCharge) + Number(a) - Number(this.contract.sales.bond))
                },
                getBuyCarTotalDB: function () {
                    //合同中首付款金额+保证金+手续费+担保费+保险费+GPS费
                    var a = 0;
                    for (var i = 0; i < this.main.repayRZDBMent.length; i++) {
                        a = Number(this.main.repayRZDBMent[i].contractRepaymentAmount) + Number(a);
                    }
                    return this.fmoney(Number(this.contract.sales.firstPayment) + Number(this.contract.sales.bond) + Number(this.contract.sales.serviceCharge) + Number(this.contract.sales.securityCharge) + Number(this.contract.sales.insurancePremium) + Number(this.contract.sales.gpsCharge) + Number(a) - Number(this.contract.sales.bond))
                },
                //首付款总欠款（首付款跟踪 首付金额+首付款垫款跟踪 首付金额）
                getPaymentTotal: function () {
                    var that = this;
                    //总欠款
                    var PaymentTotal = 0;
                    //总还款
                    var repaymentTotal = 0
                    //未到期
                    var NorepaymentTotal = 0
                    var DqMoney = 0
                    var WdqMoney = 0
                    if (this.main.repayDKMent) {
                        for (var i = 0; i < this.main.repayDKMent.length; i++) {
                            PaymentTotal = Number(this.main.repayDKMent[i].total) + Number(PaymentTotal);
                            if (this.compareDateDE(this.getNowDate(), this.main.repayDKMent[i].repaymentDate)) {
                                DqMoney = Number(this.main.repayDKMent[i].remainingArrears) + Number(this.main.repayDKMent[i].overduePenalty) + Number(DqMoney)
                                repaymentTotal = Number(this.main.repayDKMent[i].repaymentAmount) + Number(repaymentTotal)
                            }
                            if (this.compareDateDE(this.main.repayDKMent[i].repaymentDate, this.getNowDate())) {
                                WdqMoney = Number(this.main.repayDKMent[i].total) + Number(WdqMoney)
                            }
                            if (this.main.repayDKMent[i].repaymentParentList) {
                                for (var j = 0; j < this.main.repayDKMent[i].repaymentParentList.length; j++) {
                                    repaymentTotal = Number(this.main.repayDKMent[i].repaymentParentList[j].repaymentAmount) + Number(repaymentTotal);
                                    DqMoney = Number(this.main.repayDKMent[i].repaymentParentList[j].remainingArrears) + Number(this.main.repaySFMent[i].repaymentParentList[j].overduePenalty) + Number(DqMoney);
                                }
                            }
                        }
                    }
                    if (this.main.repaySFMent) {
                        for (var i = 0; i < this.main.repaySFMent.length; i++) {
                            PaymentTotal = Number(this.main.repaySFMent[i].total) + Number(PaymentTotal);
                            /**到期欠款*/
                            if (this.compareDateDE(this.main.repaySFMent[i].repaymentDate, this.getNowDate())) {
                                WdqMoney = Number(this.main.repaySFMent[i].total) + Number(WdqMoney);
                            }
                            if (this.compareDateDE(this.getNowDate(), this.main.repaySFMent[i].repaymentDate)) {
                                DqMoney = Number(this.main.repaySFMent[i].remainingArrears) + Number(this.main.repaySFMent[i].overduePenalty) + Number(DqMoney);
                            }
                            repaymentTotal = Number(this.main.repaySFMent[i].repaymentAmount) + Number(repaymentTotal)
                            if (this.main.repaySFMent[i].repaymentParentList) {
                                for (var j = 0; j < this.main.repaySFMent[i].repaymentParentList.length; j++) {
                                    repaymentTotal = Number(this.main.repaySFMent[i].repaymentParentList[j].repaymentAmount) + Number(repaymentTotal);
                                    DqMoney = Number(this.main.repaySFMent[i].repaymentParentList[j].remainingArrears) + Number(this.main.repaySFMent[i].repaymentParentList[j].overduePenalty) + Number(DqMoney);
                                }
                            }

                            //首付款总欠款
                            that.contract.main.totalDownPayment = Number(PaymentTotal)
                            //首付款总还款
                            that.contract.main.totalSFPayment = Number(repaymentTotal)
                            //剩余应还
                            that.contract.main.totalSFRemainingPayment = Number(PaymentTotal) - Number(repaymentTotal)
                            //that.contract.main.totalSFRemainingPayment =Number(NorepaymentTotal)
                            //到期
                            that.DqMoney = Number(DqMoney)
                            //未到期
                            if (that.contract.main.buyType == '内部分期') {
                                that.WdqMoney = Number(WdqMoney)
                            } else {
                                that.WdqMoney = Number(0)
                            }

                        }
                    }
                },
                //融资总欠款
                getfinancingTotal: function (type) {

                    var that = this;
                    var a = 0;
                    var repaymentTotal = 0;
                    var NorepaymentTotal = 0;
                    var FQDqMoney = 0
                    var FQWdqMoney = 0
                    if (type == 'repayFQMent') {
                        if (this.main[type]) {
                            for (var i = 0; i < this.main[type].length; i++) {
                                a = Number(this.main[type][i].total) + Number(a);
                                /**到期欠款*/
                                if (this.compareDateDE(this.getNowDate(), this.main[type][i].repaymentDate)) {
                                    FQDqMoney = Number(this.main[type][i].remainingArrears) + Number(this.main[type][i].overduePenalty) + Number(FQDqMoney)
                                }
                                if (this.compareDateDE(this.main[type][i].repaymentDate, this.getNowDate())) {
                                    FQWdqMoney = Number(this.main[type][i].total) + Number(FQWdqMoney);
                                }
                                repaymentTotal = Number(this.main[type][i].repaymentAmount) + Number(repaymentTotal)
                                if (this.main[type][i].repaymentParentList) {
                                    for (var j = 0; j < this.main[type][i].repaymentParentList.length; j++) {
                                        repaymentTotal = Number(this.main[type][i].repaymentParentList[j].repaymentAmount) + Number(repaymentTotal);
                                        FQDqMoney = Number(this.main[type][i].repaymentParentList[j].remainingArrears) + Number(this.main[type][i].repaymentParentList[j].overduePenalty) + Number(FQDqMoney);

                                    }
                                }
                            }
                        }

                    } else {
                        if (this.main[type]) {
                            for (var i = 0; i < this.main[type].length; i++) {
                                a = Number(this.main[type][i].contractRepaymentAmount) + Number(a);
                                if (this.compareDateDE(this.getNowDate(), this.main[type][i].repaymentDate)) {
                                    FQDqMoney = Number(this.main[type][i].remainingArrears) + Number(this.main[type][i].overduePenalty) + Number(FQDqMoney)
                                }
                                if (this.compareDateDE(this.main[type][i].repaymentDate, this.getNowDate())) {
                                    FQWdqMoney = Number(this.main[type][i].contractRepaymentAmount) + Number(FQWdqMoney);
                                }
                                repaymentTotal = Number(this.main[type][i].repaymentAmount) + Number(repaymentTotal)
                                if (this.main[type][i].repaymentParentList) {
                                    for (var j = 0; j < this.main[type][i].repaymentParentList.length; j++) {
                                        repaymentTotal = Number(this.main[type][i].repaymentParentList[j].repaymentAmount) + Number(repaymentTotal);
                                        FQDqMoney = Number(this.main[type][i].repaymentParentList[j].remainingArrears) + Number(this.main[type][i].repaymentParentList[j].overduePenalty) + Number(FQDqMoney);
                                    }
                                }
                            }
                        }

                    }
                    //融资总欠款
                    that.contract.main.totalArrears = Number(a)
                    //融资总还款
                    that.contract.main.totalRZPayment = Number(repaymentTotal);
                    //融资剩余还款
                    that.contract.main.totalRZRemainingPayment = Number(a) - Number(repaymentTotal);
                    that.FQDqMoney = Number(FQDqMoney)
                    if (that.contract.main.buyType == '内部分期') {
                        that.FQWdqMoney = Number(FQWdqMoney)
                    } else {
                        that.FQWdqMoney = Number(0)
                    }

                },
                showToday2: function (item) {
                    var dateTime = new Date().Format("yyyy-MM-dd");
                    var flag = false;
                    if (dateTime == item.createTime) {
                        flag = true;
                        return flag;
                    }
                    if (item.repaymentParentList) {
                        for (var i = 0; i < item.repaymentParentList.length; i++) {
                            if (dateTime == item.repaymentParentList[i].createTime) {
                                flag = true;
                                return flag;
                            }
                        }
                    }
                },
                //合计
                getCustomerMoneyTotal: function () {
                    var that = this;
                    //客户总欠款合计
                    that.contract.main.supRepayTotalAmount = Number(that.contract.main.totalArrears) + Number(that.contract.main.totalDownPayment);
                    //累计还款合计
                    that.contract.main.accumulatedRepaymentAmount = Number(that.contract.main.totalRZPayment) + Number(that.contract.main.totalSFPayment);
                    //剩余应还合计
                    that.contract.main.totalCustomerArrears = Number(that.contract.main.supRepayTotalAmount) - Number(that.contract.main.accumulatedRepaymentAmount);
                    //到期未到期合计
                    that.DqSumMoney = Number(that.FQDqMoney) + Number(that.DqMoney);
                    that.wDqSumMoney = Number(that.FQWdqMoney) + Number(that.WdqMoney);
                },
                calMoney: function () {
                    var that = this;
                    if (that.contract.main.buyType == '融资租赁') {
                        //首付款总欠款
                        that.getPaymentTotal();
                        //融资总欠款
                        that.getfinancingTotal('repayRZMent');
                        //累计还款金额<br>
                        // that.getAllPaymentTotal('repayRZMent');
                        //客户总欠款合计
                        that.getCustomerMoneyTotal()
                        //本期
                        that.thisPeriodPay('repayRZMent')
                    }
                    if (that.contract.main.buyType == '融资租赁打包') {
                        //首付款总欠款
                        that.getPaymentTotal();
                        //融资总欠款
                        that.getfinancingTotal('repayRZDBMent');
                        //累计还款金额<br>
                        // that.getAllPaymentTotal('repayRZDBMent');
                        //客户总欠款合计
                        that.getCustomerMoneyTotal()
                        //本期
                        that.thisPeriodPay('repayRZDBMent')
                    }
                    if (that.contract.main.buyType == '内部分期') {

                        //首付款总欠款
                        that.getPaymentTotal();
                        //融资总欠款
                        that.getfinancingTotal('repayFQMent');
                        //累计还款金额<br>
                        // that.getAllPaymentTotal('repayFQMent');
                        //客户总欠款合计
                        that.getCustomerMoneyTotal()
                        //本期
                        that.thisPeriodPay('repayFQMent')
                    }

                    // $(".sxtable input").each(function(){
                    //     $(this).focus()
                    //     $(this).blur();
                    // })

                }

            },
            methods: {
                onfocus1: function (i) {
                    var that = this;
                    that.currentfocus = i;
                },
                showToday: function (item, str) {
                    // return false;
                    var dateTime = new Date().Format("yyyy-MM-dd");
                    if (dateTime == item.createTime) {
                        if (str && str == "faXi") {
                            if (item.hkType == '2' || item.hkType == '3') {
                                return true
                            } else {
                                return false;
                            }
                        } else if (str && str == "qianKuan") {
                            if (item.hkType == '1') {
                                return true
                            } else {
                                return false;
                            }
                        } else {
                            return true
                        }
                    }
                },
                isMonth: function (time) {
                    if (this.thisMonth == time.substr(0, 7)) {
                        return true;
                    } else {
                        return false;
                    }
                },

                IdNumber: function (idNum) {
                    if (idNum) {
                        var firstIdNum = idNum.substring(0, 10);
                        var lastIdNum = idNum.substring(idNum.length - 4, idNum.length);
                        return firstIdNum + "****" + lastIdNum;
                    }

                },
                oneClick: function () {
                    top.closeTabByPageId("yscd");
                    top.addTabs({
                        id: 'yscd',
                        title: '应收台账冲抵',
                        close: true,
                        url: 'apply/accountReceivable/repaymentEntry.html?id=' + this.id + '&buyType=' + this.buyType,
                    });
                },
                goDetail: function (type) {
                    top.closeTabByPageId("contractDetail");
                    var that = this;
                    var id = that.contract.main.id;
                    var buyType = that.contract.main.buyType;
                    var zhihuan = that.contract.main.haveReplacement;
                    var diankuan = that.contract.main.haveRepayment;
                    var regionManagerName = that.contract.main.regionManagerName;
                    var regionManagerId = that.contract.main.regionManagerId;
                    var companyId = that.contract.main.sellerCompanyId;
                    var contractType = that.contract.main.contractType;
                    var condition = '?id=' + id + '&buyType=' + buyType + '&zhihuan=' + zhihuan + '&diankuan=' + diankuan
                        + '&regionManagerId=' + regionManagerId + '&regionManagerName=' + regionManagerName + '&contractType=' + contractType + '&companyId=' + companyId;
                    if (type == 'look') {
                        condition += '&pageType=look';
                        top.addTabs({
                            id: 'contractDetail',
                            title: '合同详情',
                            close: true,
                            url: 'apply/contract/detail_new.html' + condition
                        });
                    }


                },
                goBack: function () {
                    var pageId = top.getActivePageId();
                    top.closeTabByPageId(pageId);
                },
                inputFocus: function (id) {
                    $("#" + id).focus();
                },
                fmoney: function (s, n) {

                    n = n > 0 && n <= 20 ? n : 2;
                    s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                    var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                        t = "";
                    for (i = 0; i < l.length; i++) {
                        t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                    }
                    var str = t.split("").reverse().join("") + "." + r;
                    str = str.replace("-,", "-")
                    if (str == 0.00) {
                        str = "-"
                    }

                    return str;
                },
                strFormat: function (target, data) {
                    //此结果为了展示数据
                    var value = (target.value).trim();
                    value = value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g, '');
                    if (!value) {
                        value = 0
                    }
                    ;
                    //此结果为data存入数据
                    var dataList = data.split('.');

                    if (dataList.length > 0) {
                        if (dataList.length == 1) {
                            this[dataList[0]] = value;
                        }
                        if (dataList.length == 2) {
                            this[dataList[0]][dataList[1]] = value;
                        }
                        if (dataList.length == 3) {
                            this[dataList[0]][dataList[1]][dataList[2]] = value;
                        }
                        if (dataList.length == 4) {
                            this[dataList[0]][dataList[1]][dataList[2]][dataList[3]] = value;
                        }
                        if (dataList.length == 5) {
                            this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]] = value;
                        }
                        if (dataList.length == 6) {
                            this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]][dataList[5]] = value;
                        }
                    }
                    target.value = this.fmoney(value);
                    if (target.value == "0.00") {
                        target.value = '';
                    }
                    if (!$(target).parents("table").hasClass("sxtable")) {
                        // this.calMoney();
                    }
                },
                strFormatF: function (target, data) {
                    var value = '';
                    var dataList = data.split('.');

                    if (dataList.length > 0) {
                        if (dataList.length == 1) {
                            value = this[dataList[0]]
                        }
                        if (dataList.length == 2) {
                            value = this[dataList[0]][dataList[1]]
                        }
                        if (dataList.length == 3) {
                            value = this[dataList[0]][dataList[1]][dataList[2]]
                        }
                        if (dataList.length == 4) {
                            value = this[dataList[0]][dataList[1]][dataList[2]][dataList[3]]
                        }
                        if (dataList.length == 5) {
                            value = this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]]
                        }
                        if (dataList.length == 6) {
                            value = this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]][dataList[5]]
                        }

                    }
                    if (!value || value == '0.00') {
                        value = '';
                    }
                    target.value = value;
                    if (target.value == "0.00") {
                        target.value = '';
                    }

                },
                changeRedFn: function (type, i) {
                    var flag = true;
                    var nowDate = this.getNowDate();
                    if (!this.main[type][i].advancesDate) {
                        if (this.compareDate(nowDate, this.main[type][i].financingDate)) {
                            flag = false;
                            return flag;
                        }
                    } else {
                        if (this.main[type][i].remainingArrears != '0' && this.compareDate(nowDate, this.main[type][i].financingDate)) {
                            if (this.compareDateDE(this.main[type][i].advancesDate, this.main[type][i].financingDate)) {
                                flag = false;
                                return flag;
                            }
                        }
                    }
                    return flag;
                },
                convertAuditFlagToName: function (flage) {
                    if (flage == 1) {
                        return "已通过";
                    }
                    else if (flage == 2) {
                        return "已驳回";
                    }
                    else if (flage == 0) {
                        return "待审核";
                    }
                    else {
                        return "-";
                    }
                },
                getNumber: function (str, number) {
                    var returnNumber;
                    var that = this;
                    if (str == "担保") {
                        if (that.zhihuan === "1") {
                            number = Number(number) + 1;
                        }
                        if (that.diankuan === "1") {
                            number = Number(number) + 1;
                        }
                    }
                    if (str == "条款") {
                        if (that.buyType != '全款') {
                            number = Number(number) + 1;
                        }
                        if (that.zhihuan === "1") {
                            number = Number(number) + 1;
                        }
                        if (that.diankuan === "1") {
                            number = Number(number) + 1;
                        }
                    }
                    return that.number2big(number)
                },
                showDatePicker: function (e, item, type) {
                    var that = this;
                    WdatePicker({
                        onpicked: function (dp) {
                            if (type == 'deliveryDate') {
                                that.contract.main.deliveryDate = dp.cal.getNewDateStr();
                            } else if (type == 'paymentTime') {
                                that.contract.main.paymentTime = dp.cal.getNewDateStr();
                            } else if (type == 'actualRepaymentDate') {
                                item.actualRepaymentDate = dp.cal.getNewDateStr();
                            } else if (type == 'repaymentDate') {
                                item.repaymentDate = dp.cal.getNewDateStr();
                            } else if (type == 'financingDate') {
                                item.financingDate = dp.cal.getNewDateStr();
                            } else if (type == 'advancesDate') {
                                item.advancesDate = dp.cal.getNewDateStr();
                            } else if (type == 'collectionDate') {
                                item.collectionDate = dp.cal.getNewDateStr();
                            }

                            return true;
                        }
                    });
                    $(e.target).blur();
                },
                /*添加一行*/
                addRow: function (prop, template) {
                    var that = this;
                    if (prop == 'repayRZMent') {
                        this.main[prop].push(new Template[template]());

                    } else if (prop == 'repayRZDBMent') {
                        this.main[prop].push(new Template[template]());
                    }
                    if (prop == 'repayRZMentFn') {
                        this.main[prop].push(new Template[template]());
                    }
                    if (prop == 'repayRZMentFnDB') {
                        this.main[prop].push(new Template[template]());
                    }
                    if (prop == 'repaySFMent') {
                        this.main[prop].push(new Template[template]());

                    }
                    if (prop == 'collectionList') {
                        this.contract[prop].push(new Template[template]());
                    }
                    if (prop == 'regionManagerList' ||
                        prop == 'bigRegionManagerList' ||
                        prop == 'regionSupportList' ||
                        prop == 'creditorManagerList' ||
                        prop == 'dataManagerList'
                    ) {
                        this.contract[prop].push(new Template[template]());
                    }
                },
                number2big: function (number) {
                    switch (Number(number)) {
                        case 1:
                            return '一';
                            break;
                        case 2:
                            return '二';
                            break;
                        case 3:
                            return '三';
                            break;
                        case 4:
                            return '四';
                            break;
                        case 5:
                            return '五';
                            break;
                        case 6:
                            return '六';
                            break;
                        case 7:
                            return '七';
                            break;
                        case 8:
                            return '八';
                            break;
                        case 9:
                            return '九';
                            break;
                        case 10:
                            return '十';
                            break;
                    }
                },
                importExcel: function () {
                    var that = this;
                    setTimeout(function () {

                        var uploader = WebUploader.create({
                            // 选完文件后，是否自动上传。
                            auto: true,
                            // swf文件路径
                            swf: "/statics/plugin/webuploader-0.1.5/Uploader.swf",
                            // 文件接收服务端。
                            server: server.ip + "/importExcel/receivableFile.json",
                            // 选择文件的按钮。可选。
                            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                            pick: '#divUpload',
                            duplicate: true,
                            formData: {mainId: that.id + 2}
                        });
                        // 文件上传过程中创建进度条实时显示。
                        uploader.on('uploadProgress', function (file, percentage) {
                            var $li = $('#' + file.id),
                                $percent = $li.find('.progress span');
                            // 避免重复创建
                            if (!$percent.length) {
                                $percent = $('<p class="progress"><span></span></p>')
                                    .appendTo($li)
                                    .find('span');
                            }
                            $percent.css('width', percentage * 100 + '%');
                        });
                        uploader.on("uploadStart", function () {
                            $("#progress").show();
                        });
                        uploader.on("uploadComplete", function () {
                            $("#progress").hide();
                        });
                        // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                        uploader.on('uploadSuccess', function (file, response) {
                            alert("导入成功！");
                            $.wyui.postMethod(urlConfig.contract.selectContractById, {id: that.id}, function (data) {
                                that.main.repayRZMent = data.repaymentRZList;
                                $(".eachT input").each(function () {
                                    if (!$(this).hasClass("time")) {
                                        $(this).focus()
                                        $(this).blur()
                                    }

                                })
                            });
                        });

                        // 文件上传失败，显示上传出错。
                        uploader.on('uploadError', function (file) {
                            alert("导入失败！");
                        });
                    }, 10);
                },
                importExcelDB: function () {
                    var that = this;
                    setTimeout(function () {

                        var uploader = WebUploader.create({
                            // 选完文件后，是否自动上传。
                            auto: true,
                            // swf文件路径
                            swf: "/statics/plugin/webuploader-0.1.5/Uploader.swf",
                            // 文件接收服务端。
                            server: server.ip + "/importExcel/receivableFile.json",
                            // 选择文件的按钮。可选。
                            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                            pick: '#divUploadDB',
                            duplicate: true,
                            formData: {"mainId": that.id + 4}
                        });
                        // 文件上传过程中创建进度条实时显示。
                        uploader.on('uploadProgress', function (file, percentage) {
                            var $li = $('#' + file.id),
                                $percent = $li.find('.progress span');
                            // 避免重复创建
                            if (!$percent.length) {
                                $percent = $('<p class="progress"><span></span></p>')
                                    .appendTo($li)
                                    .find('span');
                            }
                            $percent.css('width', percentage * 100 + '%');
                        });
                        uploader.on("uploadStart", function () {
                            $("#progress").show();
                        });
                        uploader.on("uploadComplete", function () {
                            $("#progress").hide();
                        });
                        // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                        uploader.on('uploadSuccess', function (file, response) {
                            alert("导入成功！");
                            $.wyui.postMethod(urlConfig.contract.selectContractById, {id: that.id}, function (data) {
                                that.main.repayRZDBMent = data.repaymentRZDBList;
                                $(".eachT input").each(function () {
                                    if (!$(this).hasClass("time")) {
                                        $(this).focus()
                                        $(this).blur()
                                    }

                                })
                            });
                        });

                        // 文件上传失败，显示上传出错。
                        uploader.on('uploadError', function (file) {
                            alert("导入失败！");
                        });
                    }, 10);
                },
                importExcelSalesDB: function () {
                    var that = this;
                    setTimeout(function () {

                        var uploader = WebUploader.create({
                            // 选完文件后，是否自动上传。
                            auto: true,
                            // swf文件路径
                            swf: "/statics/plugin/webuploader-0.1.5/Uploader.swf",
                            // 文件接收服务端。
                            server: server.ip + "/importExcel/financingFile.json",
                            // 选择文件的按钮。可选。
                            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                            pick: '#divUploadSalesDB',
                            duplicate: true,
                            formData: {mainId: that.id + 4}
                        });


                        // 文件上传过程中创建进度条实时显示。
                        uploader.on('uploadProgress', function (file, percentage) {
                            var $li = $('#' + file.id),
                                $percent = $li.find('.progress span');
                            // 避免重复创建
                            if (!$percent.length) {
                                $percent = $('<p class="progress"><span></span></p>')
                                    .appendTo($li)
                                    .find('span');
                            }
                            $percent.css('width', percentage * 100 + '%');
                        });
                        uploader.on("uploadStart", function () {
                            $("#progress").show();
                        });
                        uploader.on("uploadComplete", function () {
                            $("#progress").hide();
                        });
                        // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                        uploader.on('uploadSuccess', function (file, response) {
                            alert("导入成功！");
                            $.wyui.postMethod(urlConfig.contract.selectContractById, {id: that.id}, function (data) {
                                that.main.repayRZMentFnDB = data.financingRZDBList;
                                $(".eachT input").each(function () {
                                    if (!$(this).hasClass("time")) {
                                        $(this).focus()
                                        $(this).blur()
                                    }

                                })
                            });
                        });

                        // 文件上传失败，显示上传出错。
                        uploader.on('uploadError', function (file) {
                            alert("导入失败！");
                        });
                    }, 10);
                },
                importExcelSales: function () {
                    var that = this;
                    setTimeout(function () {
                        var uploader = WebUploader.create({
                            // 选完文件后，是否自动上传。
                            auto: true,
                            // swf文件路径
                            swf: "/statics/plugin/webuploader-0.1.5/Uploader.swf",
                            // 文件接收服务端。
                            server: server.ip + "/importExcel/financingFile.json",
                            // 选择文件的按钮。可选。
                            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                            pick: '#divUploadSales',
                            duplicate: true,
                            formData: {mainId: that.id + 2}
                        });
                        // 文件上传过程中创建进度条实时显示。
                        uploader.on('uploadProgress', function (file, percentage) {
                            var $li = $('#' + file.id),
                                $percent = $li.find('.progress span');
                            // 避免重复创建
                            if (!$percent.length) {
                                $percent = $('<p class="progress"><span></span></p>')
                                    .appendTo($li)
                                    .find('span');
                            }
                            $percent.css('width', percentage * 100 + '%');
                        });
                        uploader.on("uploadStart", function () {
                            $("#progress").show();
                        });
                        uploader.on("uploadComplete", function () {
                            $("#progress").hide();
                        });
                        // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                        uploader.on('uploadSuccess', function (file, response) {
                            alert("导入成功！");
                            $.wyui.postMethod(urlConfig.contract.selectContractById, {id: that.id}, function (data) {
                                that.main.repayRZMentFn = data.financingRZList;
                                $(".eachT input").each(function () {
                                    if (!$(this).hasClass("time")) {
                                        $(this).focus()
                                        $(this).blur()
                                    }

                                })
                            });

                        });

                        // 文件上传失败，显示上传出错。
                        uploader.on('uploadError', function (file) {
                            alert("导入失败！");
                        });
                    }, 10);
                },
                scrollToTop: function () {
                    var that = this;
                    console.log(that.scorll)
                    if (that.scorll == "true") {
                        setTimeout(function () {  //使用  setTimeout（）方法设定定时2000毫秒
                            var scroll_offset = $(".xsht").offset();
                            console.log($(".xsht"))
                            console.log(scroll_offset)
                            $("body,html").animate({
                                scrollTop: scroll_offset.top //让body的scrollTop等于pos的top，就实现了滚动
                            }, 0);
                        }, 2000);
                    }

                },
                /*删除一行*/
                delRow: function (prop) {
                    if (prop == 'repayRZMent') {
                        this.main[prop].splice(this.main[prop].length - 1, 1);
                    } else if (prop == 'repayRZDBMent') {
                        this.main[prop].splice(this.main[prop].length - 1, 1);
                    } else if (prop == 'repaySFMent') {
                        this.main[prop].splice(this.main[prop].length - 1, 1);
                    }
                    if (prop == 'collectionList') {
                        this.contract[prop].splice(this.contract[prop].length - 1, 1);
                    }
                    if (prop == 'regionManagerList' ||
                        prop == 'bigRegionManagerList' ||
                        prop == 'regionSupportList' ||
                        prop == 'creditorManagerList' ||
                        prop == 'dataManagerList'
                    ) {
                        this.contract[prop].splice(this.contract[prop].length - 1, 1);
                    }
                },
                changeHaveSettle: function (item, value) {
                    item.haveSettle = value
                },
                fjStyle: function (fjName) {
                    if (fjName) {
                        var type = fjName.substring(fjName.lastIndexOf('.') + 1);
                        return 'img fj-' + type
                    }
                    return 'img'
                },
                download: function (attachId, fileName) {
                    downloadFile(attachId,fileName)
                    return false;
                },
                compareFiveDate: function (ydDate) {
                    var aDate = new Date(this.getNowDate()); // 通过日期字符串，初始化第一个日期对象
                    var bDate = new Date(ydDate); // 同上，初始化第二个日期对象
                    var aDay = 24 * 60 * 60 * 1000; // 完整一天有24小时，将小时换算成毫秒时间戳
                    var diffDay = (bDate - aDate) / aDay; // 计算间隔天数（注意日期隐式转换）
                    // console.log(diffDay); // 2，23日-25日间隔2天
                    return diffDay;
                },
                deleteFileRP: function (item, i, pid) {
                    if (window.confirm("确定要删除该附件吗?")) {
                        if (pid || pid === 0) {
                            this.main[item][pid].repaymentParentList[i].repaymentAttachName = "";
                            this.main[item][pid].repaymentParentList[i].repaymentAttachUrl = "";
                            $("#" + item + "repaymentParentList" + pid + i).show();
                            //加这俩行为了刷新数据 无实际意义
                            // this.main[item].push(new Template['repaySFMentList']());
                            // this.main[item].splice(this.main[item].length - 1, 1);
                        } else {
                            this.main[item][i].repaymentAttachName = "";
                            this.main[item][i].repaymentAttachUrl = "";
                            $("#" + item + i).show();
                        }
                    }

                },
                //首付款总欠款（首付款跟踪 首付金额+首付款垫款跟踪 首付金额）
                getPaymentTotal: function () {
                    var that = this;
                    //总欠款
                    var PaymentTotal = 0;
                    //总还款
                    var repaymentTotal = 0
                    //未到期
                    var NorepaymentTotal = 0
                    var DqMoney = 0
                    var WdqMoney = 0
                    if (this.main.repayDKMent) {
                        for (var i = 0; i < this.main.repayDKMent.length; i++) {
                            PaymentTotal = Number(this.main.repayDKMent[i].total) + Number(PaymentTotal);
                            if (this.compareDateDE(this.getNowDate(), this.main.repayDKMent[i].repaymentDate)) {
                                DqMoney = Number(this.main.repayDKMent[i].remainingArrears) + Number(this.main.repayDKMent[i].overduePenalty) + Number(DqMoney)
                                repaymentTotal = Number(this.main.repayDKMent[i].repaymentAmount) + Number(repaymentTotal)
                            }
                            if (this.compareDateDE(this.main.repayDKMent[i].repaymentDate, this.getNowDate())) {
                                WdqMoney = Number(this.main.repayDKMent[i].total) + Number(WdqMoney)
                            }
                            if (this.main.repayDKMent[i].repaymentParentList) {
                                for (var j = 0; j < this.main.repayDKMent[i].repaymentParentList.length; j++) {
                                    repaymentTotal = Number(this.main.repayDKMent[i].repaymentParentList[j].repaymentAmount) + Number(repaymentTotal);
                                    DqMoney = Number(this.main.repayDKMent[i].repaymentParentList[j].remainingArrears) + Number(this.main.repaySFMent[i].repaymentParentList[j].overduePenalty) + Number(DqMoney);
                                }
                            }
                        }
                    }
                    if (this.main.repaySFMent) {
                        for (var i = 0; i < this.main.repaySFMent.length; i++) {
                            PaymentTotal = Number(this.main.repaySFMent[i].total) + Number(PaymentTotal);
                            /**到期欠款*/
                            if (this.compareDateDE(this.main.repaySFMent[i].repaymentDate, this.getNowDate())) {
                                WdqMoney = Number(this.main.repaySFMent[i].total) + Number(WdqMoney);
                            }
                            if (this.compareDateDE(this.getNowDate(), this.main.repaySFMent[i].repaymentDate)) {
                                DqMoney = Number(this.main.repaySFMent[i].remainingArrears) + Number(this.main.repaySFMent[i].overduePenalty) + Number(DqMoney);
                            }
                            repaymentTotal = Number(this.main.repaySFMent[i].repaymentAmount) + Number(repaymentTotal)
                            if (this.main.repaySFMent[i].repaymentParentList) {
                                for (var j = 0; j < this.main.repaySFMent[i].repaymentParentList.length; j++) {
                                    repaymentTotal = Number(this.main.repaySFMent[i].repaymentParentList[j].repaymentAmount) + Number(repaymentTotal);
                                    DqMoney = Number(this.main.repaySFMent[i].repaymentParentList[j].remainingArrears) + Number(this.main.repaySFMent[i].repaymentParentList[j].overduePenalty) + Number(DqMoney);
                                }
                            }

                            //首付款总欠款
                            that.contract.main.totalDownPayment = Number(PaymentTotal)
                            //首付款总还款
                            that.contract.main.totalSFPayment = Number(repaymentTotal)
                            //剩余应还
                            that.contract.main.totalSFRemainingPayment = Number(PaymentTotal) - Number(repaymentTotal)
                            //that.contract.main.totalSFRemainingPayment =Number(NorepaymentTotal)
                            //到期
                            that.DqMoney = Number(DqMoney)
                            //未到期
                            if (that.contract.main.buyType == '内部分期') {
                                that.WdqMoney = Number(WdqMoney)
                            } else {
                                that.WdqMoney = Number(0)
                            }

                        }
                    }
                },
                //融资总欠款
                getfinancingTotal: function (type) {

                    var that = this;
                    var a = 0;
                    var repaymentTotal = 0;
                    var NorepaymentTotal = 0;
                    var FQDqMoney = 0
                    var FQWdqMoney = 0
                    if (type == 'repayFQMent') {
                        if (this.main[type]) {
                            for (var i = 0; i < this.main[type].length; i++) {
                                a = Number(this.main[type][i].total) + Number(a);
                                /**到期欠款*/
                                if (this.compareDateDE(this.getNowDate(), this.main[type][i].repaymentDate)) {
                                    FQDqMoney = Number(this.main[type][i].remainingArrears) + Number(this.main[type][i].overduePenalty) + Number(FQDqMoney)
                                }
                                if (this.compareDateDE(this.main[type][i].repaymentDate, this.getNowDate())) {
                                    FQWdqMoney = Number(this.main[type][i].total) + Number(FQWdqMoney);
                                }
                                repaymentTotal = Number(this.main[type][i].repaymentAmount) + Number(repaymentTotal)
                                if (this.main[type][i].repaymentParentList) {
                                    for (var j = 0; j < this.main[type][i].repaymentParentList.length; j++) {
                                        repaymentTotal = Number(this.main[type][i].repaymentParentList[j].repaymentAmount) + Number(repaymentTotal);
                                        FQDqMoney = Number(this.main[type][i].repaymentParentList[j].remainingArrears) + Number(this.main[type][i].repaymentParentList[j].overduePenalty) + Number(FQDqMoney);

                                    }
                                }
                            }
                        }

                    } else {
                        if (this.main[type]) {
                            for (var i = 0; i < this.main[type].length; i++) {
                                a = Number(this.main[type][i].contractRepaymentAmount) + Number(a);
                                if (this.compareDateDE(this.getNowDate(), this.main[type][i].repaymentDate)) {
                                    FQDqMoney = Number(this.main[type][i].remainingArrears) + Number(this.main[type][i].overduePenalty) + Number(FQDqMoney)
                                }
                                if (this.compareDateDE(this.main[type][i].repaymentDate, this.getNowDate())) {
                                    FQWdqMoney = Number(this.main[type][i].contractRepaymentAmount) + Number(FQWdqMoney);
                                }
                                repaymentTotal = Number(this.main[type][i].repaymentAmount) + Number(repaymentTotal)
                                if (this.main[type][i].repaymentParentList) {
                                    for (var j = 0; j < this.main[type][i].repaymentParentList.length; j++) {
                                        repaymentTotal = Number(this.main[type][i].repaymentParentList[j].repaymentAmount) + Number(repaymentTotal);
                                        FQDqMoney = Number(this.main[type][i].repaymentParentList[j].remainingArrears) + Number(this.main[type][i].repaymentParentList[j].overduePenalty) + Number(FQDqMoney);
                                    }
                                }
                            }
                        }

                    }
                    //融资总欠款
                    that.contract.main.totalArrears = Number(a)
                    //融资总还款
                    that.contract.main.totalRZPayment = Number(repaymentTotal);
                    //融资剩余还款
                    that.contract.main.totalRZRemainingPayment = Number(a) - Number(repaymentTotal);
                    that.FQDqMoney = Number(FQDqMoney)
                    if (that.contract.main.buyType == '内部分期') {
                        that.FQWdqMoney = Number(FQWdqMoney)
                    } else {
                        that.FQWdqMoney = Number(0)
                    }

                },
                //合计
                getCustomerMoneyTotal: function () {
                    var that = this;
                    //客户总欠款合计
                    that.contract.main.supRepayTotalAmount = Number(that.contract.main.totalArrears) + Number(that.contract.main.totalDownPayment);
                    //累计还款合计
                    that.contract.main.accumulatedRepaymentAmount = Number(that.contract.main.totalRZPayment) + Number(that.contract.main.totalSFPayment);
                    //剩余应还合计
                    that.contract.main.totalCustomerArrears = Number(that.contract.main.supRepayTotalAmount) - Number(that.contract.main.accumulatedRepaymentAmount);
                    //到期未到期合计
                    that.DqSumMoney = Number(that.FQDqMoney) + Number(that.DqMoney);
                    that.wDqSumMoney = Number(that.FQWdqMoney) + Number(that.WdqMoney);
                },
                //本期应还
                thisPeriodPay: function (type) {
                    //判断首付款
                    var SFPay = 0;
                    var RZPay = 0;
                    //首付款是否到本期
                    if (this.main.repayDKMent) {
                        for (var i = 0; i < this.main.repayDKMent.length; i++) {
                            if (Number(this.compareFiveDate(this.main.repayDKMent[i].repaymentDate)) > 0
                                && Number(this.compareFiveDate(this.main.repayDKMent[i].repaymentDate)) <= 5
                            ) {
                                SFPay = Number(this.main.repayDKMent[i].total);
                            }
                        }
                    }
                    if (this.main.repaySFMent) {
                        for (var i = 0; i < this.main.repaySFMent.length; i++) {
                            if (Number(this.compareFiveDate(this.main.repaySFMent[i].repaymentDate)) > 0
                                && Number(this.compareFiveDate(this.main.repaySFMent[i].repaymentDate)) <= 5
                            ) {
                                SFPay = Number(this.main.repaySFMent[i].total);
                            }
                        }
                    }
                    if (type == 'repayFQMent') {
                        if (this.main[type]) {
                            for (var i = 0; i < this.main[type].length; i++) {
                                if (Number(this.compareFiveDate(this.main[type][i].repaymentDate)) > 0
                                    && Number(this.compareFiveDate(this.main[type][i].repaymentDate)) <= 5
                                ) {
                                    RZPay = Number(this.main[type][i].total)
                                }
                            }
                        }
                    } else {
                        if (this.main[type]) {
                            for (var i = 0; i < this.main[type].length; i++) {
                                if (Number(this.compareFiveDate(this.main[type][i].repaymentDate)) > 0
                                    && Number(this.compareFiveDate(this.main[type][i].repaymentDate)) <= 5) {
                                    RZPay = Number(this.main[type][i].contractRepaymentAmount);
                                }
                            }
                        }
                    }
                    this.contract.main.SFPay = Number(SFPay);
                    this.contract.main.RZPay = Number(RZPay);
                    this.contract.main.totalPay = Number(SFPay) + Number(RZPay);
                },
                compareDate: function (date1, date2) {
                    var oDate1 = new Date(date1);
                    var oDate2 = new Date(date2);
                    if (oDate1.getTime() > oDate2.getTime()) {
                        return true;
                    } else {
                        return false;
                    }
                },
                compareDateDE: function (date1, date2) {
                    var oDate1 = new Date(date1);
                    var oDate2 = new Date(date2);
                    if (oDate1.getTime() >= oDate2.getTime()) {
                        return true;
                    } else {
                        return false;
                    }
                },
                getNowDate: function () {
                    var now = new Date();
                    var year = now.getFullYear();
                    var month = (now.getMonth() + 1).toString();
                    var day = (now.getDate()).toString();
                    var hour = (now.getHours()).toString();
                    var minute = (now.getMinutes()).toString();
                    var second = (now.getSeconds()).toString();
                    if (month.length == 1) {
                        month = "0" + month;
                    }
                    if (day.length == 1) {
                        day = "0" + day;
                    }
                    if (hour.length == 1) {
                        hour = "0" + hour;
                    }
                    if (minute.length == 1) {
                        minute = "0" + minute;
                    }
                    if (second.length == 1) {
                        second = "0" + second;
                    }
                    var dateTime = year + "-" + month + "-" + day;
                    return dateTime;
                },
                changeRed: function (type, i) {
                    var flag = true;
                    var nowDate = this.getNowDate();
                    if (this.contract.main.haveDsdf == '0' && (type == 'repayRZMent' || type == 'repayRZDBMent')) {
                        flag = true;
                        return flag;
                    }
                    if (!this.main[type][i].actualRepaymentDate) {
                        if (this.compareDate(nowDate, this.main[type][i].repaymentDate)) {
                            flag = false;
                            return flag;
                        }
                    } else {
                        if ((this.main[type][i].remainingArrears > '0' || this.main[type][i].overduePenalty > '0') && this.compareDate(nowDate, this.main[type][i].repaymentDate)) {
                            if (this.main[type][i].remainingArrears > '0' || this.main[type][i].overduePenalty > '0') {
                                flag = false;
                                return flag;
                            }
                            if (this.compareDateDE(this.main[type][i].actualRepaymentDate, this.main[type][i].repaymentDate)) {
                                flag = false;
                                return flag;
                            }
                        }
                        if (this.main[type][i].repaymentParentList) {
                            for (var j = 0; j < this.main[type][i].repaymentParentList.length; j++) {
                                if (this.main[type][i].repaymentParentList[j].remainingArrears > '0' && this.compareDate(nowDate, this.main[type][i].repaymentParentList[j].repaymentDate)) {
                                    if (this.compareDateDE(this.main[type][i].repaymentParentList[j].actualRepaymentDate, this.main[type][i].repaymentParentList[j].repaymentDate)) {
                                        flag = false;
                                        return flag;
                                    }
                                }
                            }
                        }
                    }
                    return flag;
                },
                isWeiXin:function () {
                    var ua = window.navigator.userAgent.toLowerCase();
                    console.log(ua);//mozilla/5.0 (iphone; cpu iphone os 9_1 like mac os x) applewebkit/601.1.46 (khtml, like gecko)version/9.0 mobile/13b143 safari/601.1
                    console.log(ua.indexOf("chrome") != -1)
                    if (ua.match(/MicroMessenger/i) == 'micromessenger'||ua.indexOf("chrome") != -1) {
                        return true;
                    } else {
                        return false;
                    }
                },
                changeYellow:function(date){
                    var that=this;
                    if (that.compareFiveDate(date)<=5&&that.compareFiveDate(date)>=0){
                        return true;
                    } else{
                        return false;
                    }

                },
                calMoney: function () {
                    var that = this;
                    if (that.contract.main.buyType == '融资租赁') {
                        //首付款总欠款
                        that.getPaymentTotal();
                        //融资总欠款
                        that.getfinancingTotal('repayRZMent');
                        //累计还款金额<br>
                        // that.getAllPaymentTotal('repayRZMent');
                        //客户总欠款合计
                        that.getCustomerMoneyTotal()
                        //本期
                        that.thisPeriodPay('repayRZMent')
                    }
                    if (that.contract.main.buyType == '融资租赁打包') {
                        //首付款总欠款
                        that.getPaymentTotal();
                        //融资总欠款
                        that.getfinancingTotal('repayRZDBMent');
                        //累计还款金额<br>
                        // that.getAllPaymentTotal('repayRZDBMent');
                        //客户总欠款合计
                        that.getCustomerMoneyTotal()
                        //本期
                        that.thisPeriodPay('repayRZDBMent')
                    }
                    if (that.contract.main.buyType == '内部分期') {

                        //首付款总欠款
                        that.getPaymentTotal();
                        //融资总欠款
                        that.getfinancingTotal('repayFQMent');
                        //累计还款金额<br>
                        // that.getAllPaymentTotal('repayFQMent');
                        //客户总欠款合计
                        that.getCustomerMoneyTotal()
                        //本期
                        that.thisPeriodPay('repayFQMent')
                    }

                    // $(".sxtable input").each(function(){
                    //     $(this).focus()
                    //     $(this).blur();
                    // })

                }
            }
            ,
            mounted: function () {
                var that = this;
                var data = {id: getUrlParamObj().id}
                var flag = false;
                if (that.pageType == 'edit') {
                    flag = true;
                    if(that.isWeiXin()){

                    }else{
                        var dialog = {
                            dialog: 'show'
                        }
                        prompt(JSON.stringify(dialog))
                    }
                    $.ajax({
                        url: server.ip + urlConfig.receivable.selectContractById,
                        contentType: 'application/json;charset=utf-8',
                        type: "POST",
                        data: JSON.stringify(data),
                        success: function (r) {
                            if(that.isWeiXin()){

                            }else{
                                var dialog = {
                                    dialog: 'hidden'
                                }
                                prompt(JSON.stringify(dialog))
                            }

                            var res = JSON.parse(r)
                            var data = res.data.sendData;
                            that.contract = data;
                            if (data.repaymentFQList) {
                                for (var i = 0; i < data.repaymentFQList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentFQList[i].repaymentDate) > 0) {
                                        data.repaymentFQList[i].xyq = true;
                                        break;
                                    }
                                }
                            }
                            if (data.repaymentDKList) {
                                for (var i = 0; i < data.repaymentDKList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentDKList[i].repaymentDate) > 0) {
                                        data.repaymentDKList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.repaymentRZList) {
                                for (var i = 0; i < data.repaymentRZList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentRZList[i].repaymentDate) > 0) {
                                        data.repaymentRZList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.repaymentRZDBList) {
                                for (var i = 0; i < data.repaymentRZDBList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentRZDBList[i].repaymentDate) > 0) {
                                        data.repaymentRZDBList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.repaymentSFList) {
                                for (var i = 0; i < data.repaymentSFList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentSFList[i].repaymentDate) > 0) {
                                        data.repaymentSFList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.financingRZList) {
                                for (var i = 0; i < data.financingRZList.length; i++) {
                                    if (that.compareFiveDate(data.financingRZList[i].financingDate) > 0) {
                                        data.financingRZList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.financingRZDBList) {
                                for (var i = 0; i < data.financingRZDBList.length; i++) {
                                    if (that.compareFiveDate(data.financingRZDBList[i].financingDate) > 0) {
                                        data.financingRZDBList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            that.contractCopy.main.actualCarBuyer = new String(that.contract.main.actualCarBuyer);
                            that.contractCopy.main.actualCarBuyerTel = new String(that.contract.main.actualCarBuyerTel);
                            that.contractCopy.main.buyerTaxNo = new String(that.contract.main.buyerTaxNo);
                            that.contractCopy.main.buyerAddress = new String(that.contract.main.buyerAddress);
                            that.contractCopy.main.legalRepresentativeName = new String(that.contract.main.legalRepresentativeName);
                            that.contractCopy.main.legalRepresentativeTel = new String(that.contract.main.legalRepresentativeTel);
                            that.contractCopy.main.actualUser = new String(that.contract.main.actualUser);
                            that.contractCopy.main.actualUserTel = new String(that.contract.main.actualUserTel);
                            that.contractCopy.main.sitePosition = new String(that.contract.main.sitePosition);
                            that.auditors = data.auditors;
                            that.copiers = data.copiers;
                            that.history = data.history;
                            that.companyInfo = {city: data.main.city, province: data.main.province};
                            that.contract.replacement.replacementsName = that.contract.replacement.replacementsName.split(",")
                            that.canUseMoney = that.contract.main.accountBalance;
                            that.main.repayFQMent = data.repaymentFQList;
                            that.main.repayDKMent = data.repaymentDKList;
                            that.main.repayRZMent = data.repaymentRZList;
                            that.main.repayRZDBMent = data.repaymentRZDBList;
                            that.main.repaySFMent = data.repaymentSFList;
                            that.main.repayRZMentFn = data.financingRZList;
                            that.main.repayRZMentFnDB = data.financingRZDBList;
                            that.contract.availableList = data.availableList;
                            that.contract.regionManagerList = data.regionManagerList;//区域经理
                            that.contract.bigRegionManagerList = data.bigRegionManagerList;//大区经理
                            that.contract.regionSupportList = data.regionSupportList;//区域支持
                            that.contract.creditorManagerList = data.creditorManagerList;//债权经理
                            that.contract.dataManagerList = data.dataManagerList;//应收专员
                            if (that.contract.main.customerCredit) {
                                if (that.contract.main.customerCredit.indexOf("T") != -1 || that.contract.main.customerCredit.indexOf("F") != -1 || that.contract.main.customerCredit.indexOf("已结清") != -1) {
                                    that.customerTypeList.splice(0, 1);
                                } else {
                                    that.customerTypeList[1].value = that.contract.main.customerCredit;
                                    that.customerTypeList[1].name = that.contract.main.customerCredit;
                                }
                            } else {
                                that.customerTypeList.splice(0, 1);
                            }
                            if (that.contract.collectionList) {
                                for (var i = 0; i < that.contract.collectionList.length; i++) {
                                    if (!that.contract.collectionList[i].createUserName) {
                                        that.contract.collectionList[i].createUserName = getCurrentUser().name
                                    }
                                }
                            }
                            that.importExcel();
                            that.importExcelSales();
                            that.importExcelSalesDB();
                            that.importExcelDB();
                            that.calMoney();
                        },
                        error: function (e) {
                            alert(e.responseText)
                        }
                    });
                } else {
                    //查看
                    if(that.isWeiXin()){

                    }else{
                        var dialog = {
                            dialog: 'show'
                        }
                        prompt(JSON.stringify(dialog))
                    }

                    $.ajax({
                        url: server.ip + urlConfig.receivable.selectContractById,
                        contentType: 'application/json;charset=utf-8',
                        type: "POST",
                        data: JSON.stringify(data),
                        success: function (r) {
                            if(that.isWeiXin()){

                            }else{
                                var dialog = {
                                    dialog: 'hidden'
                                }
                                prompt(JSON.stringify(dialog))
                            }

                            var res = JSON.parse(r)
                            that.contract = res.data.sendData
                            var data = res.data.sendData;
                            if (data.repaymentFQList) {
                                for (var i = 0; i < data.repaymentFQList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentFQList[i].repaymentDate) > 0) {
                                        data.repaymentFQList[i].xyq = true;
                                        break;
                                    }
                                }
                            }
                            if (data.repaymentDKList) {
                                for (var i = 0; i < data.repaymentDKList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentDKList[i].repaymentDate) > 0) {
                                        data.repaymentDKList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.repaymentRZList) {
                                for (var i = 0; i < data.repaymentRZList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentRZList[i].repaymentDate) > 0) {
                                        data.repaymentRZList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.repaymentRZDBList) {
                                for (var i = 0; i < data.repaymentRZDBList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentRZDBList[i].repaymentDate) > 0) {
                                        data.repaymentRZDBList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.repaymentSFList) {
                                for (var i = 0; i < data.repaymentSFList.length; i++) {
                                    if (that.compareFiveDate(data.repaymentSFList[i].repaymentDate) > 0) {
                                        data.repaymentSFList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.financingRZList) {
                                for (var i = 0; i < data.financingRZList.length; i++) {
                                    if (that.compareFiveDate(data.financingRZList[i].financingDate) > 0) {
                                        data.financingRZList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            if (data.financingRZDBList) {
                                for (var i = 0; i < data.financingRZDBList.length; i++) {
                                    if (that.compareFiveDate(data.financingRZDBList[i].financingDate) > 0) {
                                        data.financingRZDBList[i].xyq = true
                                        break;
                                    }
                                }
                            }
                            that.contractCopy.main.actualCarBuyer = new String(that.contract.main.actualCarBuyer);
                            that.contractCopy.main.actualCarBuyerTel = new String(that.contract.main.actualCarBuyerTel);
                            that.contractCopy.main.buyerTaxNo = new String(that.contract.main.buyerTaxNo);
                            that.contractCopy.main.buyerAddress = new String(that.contract.main.buyerAddress);
                            that.contractCopy.main.legalRepresentativeName = new String(that.contract.main.legalRepresentativeName);
                            that.contractCopy.main.legalRepresentativeTel = new String(that.contract.main.legalRepresentativeTel);
                            that.contractCopy.main.actualUser = new String(that.contract.main.actualUser);
                            that.contractCopy.main.actualUserTel = new String(that.contract.main.actualUserTel);
                            that.contractCopy.main.sitePosition = new String(that.contract.main.sitePosition);
                            that.auditors = data.auditors;
                            that.copiers = data.copiers;
                            that.history = data.history;
                            that.companyInfo = {city: data.main.city, province: data.main.province};
                            that.contract.replacement.replacementsName = that.contract.replacement.replacementsName.split(",")
                            that.canUseMoney = that.contract.main.accountBalance;
                            that.main.repayFQMent = data.repaymentFQList;
                            that.main.repayDKMent = data.repaymentDKList;
                            that.main.repayRZMent = data.repaymentRZList;
                            that.main.repayRZDBMent = data.repaymentRZDBList;
                            that.main.repaySFMent = data.repaymentSFList;
                            that.main.repayRZMentFn = data.financingRZList;
                            that.main.repayRZMentFnDB = data.financingRZDBList;
                            that.contract.availableList = data.availableList;
                            that.contract.regionManagerList = data.regionManagerList;//区域经理
                            that.contract.bigRegionManagerList = data.bigRegionManagerList;//大区经理
                            that.contract.regionSupportList = data.regionSupportList;//区域支持
                            that.contract.creditorManagerList = data.creditorManagerList;//债权经理
                            that.contract.dataManagerList = data.dataManagerList;//应收专员
                            if (that.contract.main.customerCredit) {
                                if (that.contract.main.customerCredit.indexOf("T") != -1 || that.contract.main.customerCredit.indexOf("F") != -1 || that.contract.main.customerCredit.indexOf("已结清") != -1) {
                                    that.customerTypeList.splice(0, 1);
                                } else {
                                    that.customerTypeList[1].value = that.contract.main.customerCredit;
                                    that.customerTypeList[1].name = that.contract.main.customerCredit;
                                }
                            } else {
                                that.customerTypeList.splice(0, 1);
                            }
                            if (that.contract.collectionList) {
                                for (var i = 0; i < that.contract.collectionList.length; i++) {
                                    if (!that.contract.collectionList[i].createUserName) {
                                        that.contract.collectionList[i].createUserName = getCurrentUser().name
                                    }
                                }
                            }
                            that.importExcel();
                            that.importExcelSales();
                            that.importExcelSalesDB();
                            that.importExcelDB();
                            that.calMoney();
                        },
                        error: function (e) {
                            alert(e.responseText)
                        }
                    });
                }
            }
        })
    ;
</script>
<script>
    //
    <!--自动补全-->
    function renderLines(el, lineIndex) {
        $(el).autoComplete({
            url: server.ip + urlConfig.system.user.getCosterTop10ByNameUser,
            render: function (users, panel) {
                if (users) {
                    for (var i = 0; i < users.length; i++) {
                        $("<li></li>").data("autoComplete",
                            users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                            "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                            .appendTo(panel);
                    }
                }
            },
            selected: function (user) {
                if ($(el).hasClass("regionManagerName")) {
                    app.contract.regionManagerList[app.currentfocus].historyManagerName = user.name;
                    app.contract.regionManagerList[app.currentfocus].historyManagerId = user.id;
                }
                if ($(el).hasClass("regionalSupportName")) {
                    app.contract.regionSupportList[app.currentfocus].historyManagerName = user.name;
                    app.contract.regionSupportList[app.currentfocus].historyManagerId = user.id;
                }
                if ($(el).hasClass("bigRegionManagerName")) {
                    app.contract.bigRegionManagerList[app.currentfocus].historyManagerName = user.name;
                    app.contract.bigRegionManagerList[app.currentfocus].historyManagerId = user.id;
                }
                if ($(el).hasClass("creditManagerName")) {
                    app.contract.creditorManagerList[app.currentfocus].historyManagerName = user.name;
                    app.contract.creditorManagerList[app.currentfocus].historyManagerId = user.id;
                }
                if ($(el).hasClass("dataOfficerName")) {
                    app.contract.dataManagerList[app.currentfocus].historyManagerName = user.name;
                    app.contract.dataManagerList[app.currentfocus].historyManagerId = user.id;
                }
                return false;
            },
            extraParams: {createUserId: getCurrentUser().id},
            height: 210,
            width: 300
        });
    }

    Vue.directive('line-inserted', {
        inserted: function (el, binding) {
            console.log(el);
            var lineIndex = binding.value;
            renderLines(el, lineIndex);
        }
    });
    Vue.directive('scroll-div', {
        inserted: function (el, binding) {
            console.log(el);
            if (app.scorll == "true") {
                var scroll_offset = $(el).offset();
                console.log(scroll_offset)
                $("body,html").animate({
                    scrollTop: scroll_offset.top //让body的scrollTop等于pos的top，就实现了滚动
                }, 0);
            }
        }
    });
    $("#jgregionManagerName").autoComplete({
        url: server.ip + urlConfig.contract.getRegionManagerByUserId,
        render: function (users, panel) {
            for (var i = 0; i < users.length; i++) {
                $("<li></li>").data("autoComplete",
                    users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                    "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                    .appendTo(panel);
            }
        },
        selected: function (user) {
            app.contract.main.takeOverManagerId = user.id;
            app.contract.main.takeOverManager = user.name;
            return false;
        },
        height: 210,
        width:
            420
    });

</script>

<script>
    $(window).scroll(function() {
        //客户基本信息高度 khjbxx
      var type=app.contract.main.buyType;
      var top= $(window).scrollTop();
      var header2H=$(".header2").offset().top;
        var header3H=$(".header3").offset().top;

        console.log(top,header2H,header3H)
        if(type=="全款"){
            if(top<header2H){
                $(".fix1").css("display","table");
                $(".fix2").hide();
                $(".fix3").hide();
            }
            else  if(top>=header2H&&top<header3H){
                $(".fix1").hide();
                $(".fix2").css("display","table");
                $(".fix3").hide();
            }else if(top>header3H){
                $(".fix1").hide();
                $(".fix2").hide();
                $(".fix3").css("display","table");
            }
        }else{
            var header4H=$(".header4").offset().top;
            if(top<header2H){
                console.log("121")
                $(".fix1").css("display","table");
                $(".fix2").hide();
                $(".fix3").hide();
                $(".fix4").hide();
            }
            else  if(top>=header2H&&top<header3H){
                console.log("1212")
                $(".fix1").hide();
                $(".fix2").css("display","table");
                $(".fix3").hide();
                $(".fix4").hide();
            }else if(top>=header3H&&top<header4H){
                $(".fix1").hide();
                $(".fix2").hide();
                $(".fix3").css("display","table");
                $(".fix4").hide();
            }else if(top>header4H){
                $(".fix1").hide();
                $(".fix2").hide();
                $(".fix3").hide();
                $(".fix4").css("display","table");
            }
        }

    });
</script>
</body>
</html>